Rails remove old models with migrations

后端 未结 7 1915
傲寒
傲寒 2021-02-13 01:41

I have a bunch of rails models that i\'m re-writing into a single model to simplify my code and reduce unnecessary tables.

I\'m wondering what the best way to delete a

7条回答
  •  隐瞒了意图╮
    2021-02-13 02:06

    The question is a bit stale now, but I just did:

    rails destroy scaffold  -p
    

    The -p flag shows "pretend" output, which is good for seeing what will happen. Remove the '-p' flag and the results will match the output. This cleaned the entire collection of M-V-C files + testing + js files + the original migration, no problem.

    I guess if you are one who likes to hand edit your migrations and include multiple steps in each, losing the original migration could break db:setup, so buyer beware. Keeping one action == one migration file should avoid this potential snafu.

提交回复
热议问题