目前我正在使用一个巨大的 rails 应用程序和多个分支,每个分支都有这个应用程序的新功能。经常发生需要迁移的功能,在您将其与 master 合并之前这应该不是问题:schema.rb 已使用您的开发数据库的信息进行了更新!
澄清:
1. Branch A has migration create_table_x
2. Branch B has migration create_table_y
3. Branch A adds another create_table_z and runs db:migrate
4. You want to merge Branch A with Master and you see table_x, table_y and table_z in the schema.rb of Branch A.
在分支中的每次迁移之前重置+种子数据库或为每个分支创建数据库不是一个选项。由于 2 GB SQL 数据的巨大大小,它是行不通的。
我的问题:
是否真的需要将 schema.rb 保留在存储库中,因为每次迁移都会重建它?
如果是这样,是否可以从迁移而不是数据库转储中构建模式?