Allow to use the latest migration in migration specs
This is useful for migration tests that relies on factories and that are very old and/or tedious to modify to not use factories. Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
parent
5912d9b70b
commit
f6357b77ff
1 changed files with 7 additions and 1 deletions
|
@ -45,7 +45,13 @@ module MigrationsHelpers
|
||||||
end
|
end
|
||||||
|
|
||||||
def migration_schema_version
|
def migration_schema_version
|
||||||
self.class.metadata[:schema] || previous_migration.version
|
metadata_schema = self.class.metadata[:schema]
|
||||||
|
|
||||||
|
if metadata_schema == :latest
|
||||||
|
migrations.last.version
|
||||||
|
else
|
||||||
|
metadata_schema || previous_migration.version
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def schema_migrate_down!
|
def schema_migrate_down!
|
||||||
|
|
Loading…
Reference in a new issue