CREATE TABLE IF NOT EXISTS school_product_config (
  school_id VARCHAR(64) NOT NULL PRIMARY KEY,
  organization_mode VARCHAR(32) NOT NULL DEFAULT 'ADMIN_CLASS_ENABLED',
  student_roster_owner VARCHAR(32) NOT NULL DEFAULT 'SCHOOL_ADMIN',
  create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) COMMENT='school product capability configuration';

INSERT INTO school_product_config (school_id, organization_mode, student_roster_owner)
SELECT school_id, 'ADMIN_CLASS_ENABLED', 'SCHOOL_ADMIN' FROM school
ON DUPLICATE KEY UPDATE school_id = VALUES(school_id);

ALTER TABLE teaching_class_student MODIFY admin_class_id VARCHAR(64) NULL;
