alter table org_lesson add creator_id bigint not null comment '创建人id', add create_time datetime default current_timestamp not null comment '创建时间'; -- 删除外键 alter table org drop foreign key FK_company_department_company_department1; alter table org_lesson drop foreign key org_lesson_ibfk_1; alter table org_lesson drop foreign key org_lesson_ibfk_2; alter table org_user drop foreign key FK_department_user_company_department1; alter table org_user drop foreign key FK_department_user_sys_use1r; alter table org_exam drop foreign key org_exam_ibfk_1; alter table org_exam drop foreign key org_exam_ibfk_2; -- 修改id数据类型 alter table org modify id bigint auto_increment; alter table org modify parent_id bigint null comment '父级id'; alter table org modify root_id bigint null comment '单位id'; alter table race_question_progress modify company_id bigint null; alter table race_result modify company_id bigint null comment '公司id'; alter table race_question modify company_id bigint null comment '公司题库'; alter table race_questions_rules modify company_id bigint null; alter table org_scoring_rule_rel modify org_id bigint not null; alter table org_lesson modify org_id bigint not null comment '班级id'; alter table org_scoring_rule modify org_id bigint not null comment '该规则属于哪个顶级组织'; alter table org_user modify org_id bigint not null comment '部门id'; -- 添加字段 alter table org_scoring_rule_rel add rule_org_id bigint not null comment '规则关联的顶级组织id', add rule_school_year varchar(16) not null comment '规则所属学年', add rule_term int(1) not null comment '规则所属学期', add rule_creator_id bigint not null comment '创建者id';