SET @db = DATABASE();

SET @sql = IF(
    EXISTS(
        SELECT 1 FROM information_schema.COLUMNS
        WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'gxmu_declare' AND COLUMN_NAME = 'project_type'
    ),
    'SELECT 1',
    'ALTER TABLE gxmu_declare ADD COLUMN project_type VARCHAR(100) NULL COMMENT ''挑战杯项目类型'' AFTER module'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

SET @sql = IF(
    EXISTS(
        SELECT 1 FROM information_schema.COLUMNS
        WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'gxmu_declare' AND COLUMN_NAME = 'project_group'
    ),
    'SELECT 1',
    'ALTER TABLE gxmu_declare ADD COLUMN project_group VARCHAR(255) NULL COMMENT ''挑战杯项目分组'' AFTER project_type'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
