migrations icon indicating copy to clipboard operation
migrations copied to clipboard

Migrator should re-create the schema when the migration date is older than the last file modification

Open pabloelcolombiano opened this issue 3 years ago • 5 comments

This is a (multiple allowed):

  • [] bug
  • [x] enhancement
  • [x] feature-discussion (RFC)

This is an improvement suggestion for the MIgrator.

The migrator recreates the schema when the migrations have changed. For example: a new migration was added.

However while developing, it can happen that a migration has not been added, but modified (a field renamed, or added, etc). In this case also it is required to recreate the schema, which has to be doen manually.

The proposal would be not to look for new migrations only, but also check that the date of modification of the migration files are older than the date where the respective migration was run.

PR coming if interest arises.

pabloelcolombiano avatar Dec 09 '21 14:12 pabloelcolombiano

Seems like a good improvement to me.

markstory avatar Dec 09 '21 17:12 markstory

This should help with branch switching.

othercorey avatar Dec 09 '21 18:12 othercorey

Branch switching is already handled by the Migrator. This would rather cover the case where you are on the same branch, but modifying your migration files.

pabloelcolombiano avatar Dec 10 '21 11:12 pabloelcolombiano

@pabloelcolombiano Were you planning on writing this or just a request?

othercorey avatar Feb 22 '22 09:02 othercorey

@othercorey the plan was to implement it, but could not find time for the moment, and will not in the coming 2 weeks. It is a very minor improvement, though.

pabloelcolombiano avatar Feb 22 '22 11:02 pabloelcolombiano