rails + sqlite - 由于外键问题,无法从数据库中删除列 [英] rails + sqlite - Can't remove columns from database due to foreign key issue
本文介绍了rails + sqlite - 由于外键问题,无法从数据库中删除列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前无法从数据库中的特定表中删除列.sqlite3 给我的错误消息是:
I'm currently unable to delete a column from a specific table in my database. the error message sqlite3 gives me is:
FOREIGN KEY 约束失败:DROP TABLE 'table_name'
FOREIGN KEY constraint failed: DROP TABLE 'table_name'
虽然我不想删除表,但我的迁移是
I am not trying to drop a table though, my migration is
remove_column :table_name, :column_name
这只是一个字符串数据列,没什么特别的
This is just a string data column, nothing special about it
推荐答案
我做了 ruby db:migrate:redo
并且成功了.
I did ruby db:migrate:redo
and it worked.
这篇关于rails + sqlite - 由于外键问题,无法从数据库中删除列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文