Run a single migration file

后端 未结 11 752
说谎
说谎 2020-11-30 16:01

Is there an easy way to run a single migration? I don\'t want to migrate to a certain version I just want to run a specific one.

11条回答
  •  情书的邮戳
    2020-11-30 16:48

    Method 1 :

    rake db:migrate:up VERSION=20080906120000
    

    Method 2:

    In Rails Console 1. Copy paste the migration class in console (say add_name_to_user.rb) 2. Then in console, type the following

    Sharding.run_on_all_shards{AddNameToUser.up}
    

    It is done!!

提交回复
热议问题