我希望从 schema.rb 生成一个迁移文件.是否可以?
I'm looking to generate a migration file from the schema.rb. is it possible?
我目前有许多迁移文件,并希望将所有内容合并到一个主迁移文件中.
I have many migration files at the moment and would like to combine everything into one master migration file.
我还认为我可能在某些时候不小心删除了迁移文件.
I also think i may have accidentally deleted a migration file at some point.
感谢您的帮助
推荐答案没必要这么做.对于新安装,您应该运行 rake db:schema:load,而不是 rake db:migrate,这会将模式加载到数据库中,这比运行所有迁移.
There's no need to do this. For new installations you should be running rake db:schema:load, not rake db:migrate, this will load the schema into the database, which is faster than running all the migrations.
您不应该删除迁移,当然也不应该合并它们.至于误删,你应该使用版本控制系统,比如Git.
You should never delete migrations, and certainly not combine them. As for accidentally deleting one, you should be using a version control system, such as Git.
更多推荐
从 schema.rb 生成迁移文件
发布评论