sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1091, "Can't DROP 'users_ibfk_1'; check that column/key exists") [SQL: ALTER TABLE users DROP FOREIGN KEY users_ibfk_1]


 

flask 迁移数据库报错

报错:

sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1091, "Can't DROP 'users_ibfk_1'; check that column/key exists")
[SQL: ALTER TABLE users DROP FOREIGN KEY users_ibfk_1]

解决办法:

将每个数据库表类型InnoDB转为 MyISAM

 

如果报错ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constrain fails。

需要删除每个表的外键限制

如果需要表类型InnoDB,迁移完在转回去


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM