rt-sim-training-service/sql/20220713-thesai.sql
2022-07-14 18:16:44 +08:00

26 lines
698 B
SQL

-- 课程表添加字段
ALTER TABLE `ls_lesson`
ADD COLUMN `org_id` bigint(20) NULL COMMENT '创建者创建这条数据时所属组织' AFTER `update_time`;
-- 数据处理SQL
UPDATE ls_lesson lesson,
org_user ou
SET lesson.org_id = ou.org_id
WHERE
lesson.creator_id = ou.user_id
AND ou.role = 'Admin'
AND lesson.sysFault = 0;
-- 考试表添加字段
ALTER TABLE `exam_definition`
ADD COLUMN `org_id` bigint NULL COMMENT '创建者创建这条数据时所属的组织' AFTER `passing_point`;
-- 数据处理SQL
UPDATE exam_definition exam,
org_user ou
SET exam.org_id = ou.org_id
WHERE
exam.creator_id = ou.user_id
AND ou.role = 'Admin'
AND exam.system = 0;