After using PowerDesigner to design the database, import navicat and find that the primary key cannot be set to auto-increment

After using PowerDesigner to design the database, import it into navicat and find that the primary key cannot be set to auto-increment. How to solve it?

1833 - Cannot change column ‘id’:used in a foreign key constraint ‘FK_Relationship_3’ of table ‘hotelmanagesystem.orderlist’
insert image description here
1.

set foreign_key_checks = 0;
ALTER TABLE tablename MODIFY COLUMN id int(11) NOT NULL AUTO_INCREMENT FIRST;

Each table can be executed in turn

As shown in the figure, it can run successfully:
insert image description here
2. I found that if you do not use powerdesigner to import, if you design directly in navicat, you can directly add auto-increment to the primary key as the foreign key.

Reference blog post: https://blog.csdn.net/weixin_41779914/article/details/108188233

Guess you like

Origin blog.csdn.net/qq_41544842/article/details/113592733