-
Notifications
You must be signed in to change notification settings - Fork 25
Description
I think I've encountered what might be a bug:
If I run bin/rails g lhm FooMigration it will add a new file e.g. db/lhm/20230113104049_foo_migration.rb
If I then run bin/rails db:reset I would expect this migration to be in the list of pending migrations in the output e.g.
You have 1 pending migration:
20230113104049 FooMigration
But no pending migrations are listed.
If I then run bin/rails db:migrate the migration does not get run. Rails thinks it has already been run.
I've investigated a little and know that this is because when I run bin/rails db:reset, the migration's timestamp gets added to the schema_migrations table.
bin/rails db:migrate will only run migrations which do not have their timestamp in this table already.
I think the bug is that the migration's timestamp should not be added to schema_migrations on db:reset, it should be added only when the migration has run with db:migate.
If I put the LHM migration file in db/migrate instead of db/lhm the above issues are not seen.