简体   繁体   中英

Rails Schema changes unintentionally whenever I run rake db:migrate

Whenever I run rake db:migrate, it updates my rails Schema by removing the foreign keys on one particular table. I can't understand why and I'm not sure how to prevent this from happening.

[1] http://imgur.com/BBssPdU

How can I solve this problem? I can't write another migration to re-add references because it throws a duplication error.

Could you please post the full migration file?

Also, have you tried rolling back to before the last migration using rake db:rollback ? (You can also rollback several migrations, see here )

CARE! Rolling back can delete data from your database so if you cannot afford to have that happen then perhaps this isn't the best solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM