Way to “flatten” Rails migrations?

前端 未结 2 1198
半阙折子戏
半阙折子戏 2021-02-13 22:26

I\'m working on deploying my first Rails application right now, and somewhere along the way, I botched a migration. When I try to push my application to the production server an

2条回答
  •  无人共我
    2021-02-13 22:38

    If you edited the schema directly you will need to run:

    rake db:schema:dump
    

    This will take whatever is in the database and create a schema.rb file. Then you can run rake db:schema:load anytime you want. However it will mean that your migrations are still bad. You could delete all of them and recreate them from the schema.rb file.

提交回复
热议问题