Rails: Alter migrations during early development phases

前端 未结 6 586
栀梦
栀梦 2021-02-04 22:08

During the very early phases of development in a Rails app, I prefer to modify the migrations files directly to add new columns (fields) to my tables (models) instead of piling

6条回答
  •  囚心锁ツ
    2021-02-04 22:35

    I run the following commands to solve this problem. Save it in a script and you are ready to go! Of course, this presumes that losing the data is fine. Loading the fixtures is easy enough to add to this script in any case.

    #!/bin/sh
    rake db:drop
    rake db:create
    rake db:migrate --trace
    

    PS: My friend who gave me this idea calls this script rake_dance :)

提交回复
热议问题