200240428_sql.sql 879 B

1234567891011121314151617181920212223242526272829
  1. -- 添加班级类型字段
  2. DROP PROCEDURE IF EXISTS createCom;
  3. DELIMITER $$
  4. CREATE
  5. PROCEDURE createCom()
  6. BEGIN
  7. IF NOT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name='base_class' AND COLUMN_NAME = 'class_type') THEN
  8. ALTER TABLE `base_class`
  9. ADD COLUMN `class_type` VARCHAR(50) NULL COMMENT '班级类型(xjr_dictionary_item[class_type])' AFTER `is_graduate`;
  10. END IF;
  11. END$$
  12. DELIMITER ;
  13. CALL createCom;
  14. DROP PROCEDURE createCom;
  15. DROP PROCEDURE IF EXISTS createCom;
  16. DELIMITER $$
  17. CREATE
  18. PROCEDURE createCom()
  19. BEGIN
  20. IF NOT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_name='wf_course_adjust' AND COLUMN_NAME = 'class_id') THEN
  21. ALTER TABLE `wf_course_adjust`
  22. ADD COLUMN `class_id` BIGINT NULL COMMENT '班级id';
  23. END IF;
  24. END$$
  25. DELIMITER ;
  26. CALL createCom;
  27. DROP PROCEDURE createCom;