Jose K J
Jose K J

Reputation: 183

how do typeorm generate migrations automatically?

how do typeorm generate migrations automatically? i want typeorm to generate only from particular timestamp onwards, is it possible to limit so? i have run few db updates directly in db instead of through migration, ...... currently these manually done migrations are also getting generated in migration files saw about fake command, but it seems not available in my current version i tried to generate a migration and add its timestamp, filename in migrations table even after this, its creating old db changes in migration file,

please guide me

Upvotes: 1

Views: 715

Answers (1)

Jose K J
Jose K J

Reputation: 183

typeorm migration generate seems to compare entity file with the db and decides that

  • things not in entity and present in db need to be dropped and
  • things mentioned in entity but not in db need to be created

So old changes in my migration was because, db and my entity was not in sync. Making sure that all entity is upto date and generating a migration and running it almost resolve my issue.

After migration is run, the timestamp, filename gets added to migrations table

Upvotes: 1

Related Questions