exactly what does rake db:migrate do?

前端 未结 3 1421
孤独总比滥情好
孤独总比滥情好 2021-02-07 00:58

Does rake db:migrate only add new migrations, or does it drop all migrations/changes and build everything new?

I think rake is throwing an error because it is trying to

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-07 01:39

    Everytime you create a migration using scripts (like script/generate model ...) a new migration is added to the correct directory ready to be synched with the real database.

    Actually rake db:migrate just checks which missing migrations still need to be applied to the database without caring about the previouse ones.

    Of course if you modify the database using other ways is common to obtain out-of-synch things because as you said you can find yourself applying a migration to something that is changed underneath.

提交回复
热议问题