Ruby on Rails: adding columns to existing database

前端 未结 7 716
Happy的楠姐
Happy的楠姐 2021-01-30 07:49

I\'m getting an error:

SQLite3::SQLException: no such column: ideas.list_id: 
SELECT \"ideas\".* FROM \"ideas\"  
WHERE \"ideas\".\"list_id\" = 2
7条回答
  •  清歌不尽
    2021-01-30 08:15

    migration file name has the datetime encoded in its name so rails run this migration one and do not run it again unless you do a rollback

    and here come the magic of migration to build you db with small steps so no need to update a migration after run rake db:migrate , you should make a new migration to do the change you want to your db schema

    and remember to

    remove the added line form the old migration file as it might raise errors if you decided to rollback this migration

提交回复
热议问题