Remove rails model after migration

后端 未结 3 1451
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-06 05:38

It seems strange to me, that creation of model, running migration, destroying it, and creating again same model reports SQL exception:

project|master ⇒ rails g m         


        
3条回答
  •  闹比i
    闹比i (楼主)
    2021-02-06 06:03

    rails d model name 
    

    This just deletes the model and not the migration you have run (which created the table in the database).

    If you want to delete both the model and the tables, you will have to do the following

    rake db:rollback 
    rails d model name
    

提交回复
热议问题