How do you skip failed migrations? (rake db:migrate)

前端 未结 7 1766
忘了有多久
忘了有多久 2021-01-30 16:32

I can\'t seem to find an option or anything that allows me to skip migrations.

I know what you\'re thinking: \"you should never have to do that...\"

I need to sk

7条回答
  •  野性不改
    2021-01-30 17:24

    This is a good way to do it for one-off errors.

    db:migrate:up VERSION=my_version

    This will run one specific migration's "up" actions. (There is also the opposite if you need it, just replace "up" with "down".) So this way you can either run the future migration that makes the older one (that you need to skip) work, or just run each migration ahead of it selectively.

    I also believe that you can redo migrations this way:

    rake db:migrate:redo VERSION=my_version

    I have not tried that method personally, so YMMV.

提交回复
热议问题