(1832, "Cannot change column 'user_id': used in a foreign key constraint 'wx_balance_flow_record_RM

sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1832, "Cannot change column 'user_id': used in a foreign key constraint 'wx_balance_flow_record_RMB_ibfk_1'") [SQL: 'ALTER TABLE `wx_balance_flow_record_RMB` MODIFY user_id INTEGER(11) NOT NULL'] (Background on this error at: http://sqlalche.me/e/2j85)

 

数据库迁移报错,

先进mysql执行

 SET foreign_key_checks = 0 ;  

然后执行报错的语句

ALTER TABLE `wx_balance_flow_record_RMB` MODIFY user_id INTEGER(11) NOT NULL;

然后 

SET foreign_key_checks = 1;

然后再迁移

 (1832,

 

参考: 

https://www.jb51.cc/mysql/432883.html

https://community.atlassian.com/t5/Confluence-questions/How-to-get-past-the-following-quot-Cannot-change-column-xxx-used/qaq-p/117216

你可能感兴趣的:(Python)