提交 f6357b77 编写于 作者: R Rémy Coutable

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: NRémy Coutable <remy@rymai.me>
上级 5912d9b7
......@@ -45,7 +45,13 @@ module MigrationsHelpers
end
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
def schema_migrate_down!
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册