SpringBlade bug 为id添加自增长属性(已改)
原文:
https://www.cnblogs.com/guxingy/p/13433968.html
执行SQL语句后,id是没有自增长属性的,需要为每一张表添加自增长属性。
注意:表blade_region不需要自增长Id,因为id这个列都没有,并且他的主键是字符串类型
生成SQl的语句
我这里用的数据库是blade2,改成自己的数据库名就可以
代码下的最新版,smallc-SpringBlade-2.0-boot
select
CONCAT('ALTER TABLE ',table_name,' CHANGE id id BIGINT auto_increment not null;')
from information_schema.tables
where table_schema='blade2' and table_name!='blade_region'
ALTER TABLE blade_client CHANGE id id BIGINT auto_increment not null;
ALTER TABLE blade_code CHANGE id id BIGINT auto_increment not null;
ALTER TABLE blade_datasource CHANGE id id BIGINT auto_increment not null;
ALTER TABLE blade_dept CHANGE id id BIGINT auto_increment not null;
ALTER TABLE blade_dict CHANGE id id BIGINT auto_increment not null;
ALTER TABLE blade_log_api CHANGE id id BIGINT auto_increment not null;
ALTER TABLE blade_log_error CHANGE id id BIGINT auto_increment not null;
ALTER TABLE blade_log_usual CHANGE id id BIGINT auto_increment not null;
ALTER TABLE blade_menu CHANGE id id BIGINT auto_increment not null;
ALTER TABLE blade_notice CHANGE id id BIGINT auto_increment not null;
ALTER TABLE blade_param CHANGE id id BIGINT auto_increment not null;
ALTER TABLE blade_post CHANGE id id BIGINT auto_increment not null;
ALTER TABLE blade_role CHANGE id id BIGINT auto_increment not null;
ALTER TABLE blade_role_menu CHANGE id id BIGINT auto_increment not null;
ALTER TABLE blade_tenant CHANGE id id BIGINT auto_increment not null;
ALTER TABLE blade_user CHANGE id id BIGINT auto_increment not null;
ALTER TABLE blade_user_oauth CHANGE id id BIGINT auto_increment not null;

浙公网安备 33010602011771号