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 = 'year'
    ),
    'SELECT 1',
    'ALTER TABLE gxmu_declare ADD COLUMN year INT NULL COMMENT ''年度'''
);
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_qmgc_form' AND COLUMN_NAME = 'year'
    ),
    'SELECT 1',
    'ALTER TABLE gxmu_qmgc_form ADD COLUMN year INT NULL COMMENT ''年度'''
);
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_sjqn' AND COLUMN_NAME = 'year'
    ),
    'SELECT 1',
    'ALTER TABLE gxmu_sjqn ADD COLUMN year INT NULL COMMENT ''年度'''
);
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_sjtbzbsj' AND COLUMN_NAME = 'year'
    ),
    'SELECT 1',
    'ALTER TABLE gxmu_sjtbzbsj ADD COLUMN year INT NULL COMMENT ''年度'''
);
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_tzbcy_form' AND COLUMN_NAME = 'year'
    ),
    'SELECT 1',
    'ALTER TABLE gxmu_tzbcy_form ADD COLUMN year INT NULL COMMENT ''年度'''
);
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_wshqtw' AND COLUMN_NAME = 'year'
    ),
    'SELECT 1',
    'ALTER TABLE gxmu_wshqtw ADD COLUMN year INT NULL COMMENT ''年度'''
);
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_wshqtzb' AND COLUMN_NAME = 'year'
    ),
    'SELECT 1',
    'ALTER TABLE gxmu_wshqtzb ADD COLUMN year INT NULL COMMENT ''年度'''
);
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_wxxzx_applicant' AND COLUMN_NAME = 'year'
    ),
    'SELECT 1',
    'ALTER TABLE gxmu_wxxzx_applicant ADD COLUMN year INT NULL COMMENT ''年度'''
);
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_wxxzx_budget' AND COLUMN_NAME = 'year'
    ),
    'SELECT 1',
    'ALTER TABLE gxmu_wxxzx_budget ADD COLUMN year INT NULL COMMENT ''年度'''
);
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_wxxzx_guidance_teacher' AND COLUMN_NAME = 'year'
    ),
    'SELECT 1',
    'ALTER TABLE gxmu_wxxzx_guidance_teacher ADD COLUMN year INT NULL COMMENT ''年度'''
);
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_wxxzx_project' AND COLUMN_NAME = 'year'
    ),
    'SELECT 1',
    'ALTER TABLE gxmu_wxxzx_project ADD COLUMN year INT NULL COMMENT ''年度'''
);
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_wxxzx_review_member' AND COLUMN_NAME = 'year'
    ),
    'SELECT 1',
    'ALTER TABLE gxmu_wxxzx_review_member ADD COLUMN year INT NULL COMMENT ''年度'''
);
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_yxgqtdgb' AND COLUMN_NAME = 'year'
    ),
    'SELECT 1',
    'ALTER TABLE gxmu_yxgqtdgb ADD COLUMN year INT NULL COMMENT ''年度'''
);
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_yxgqty' AND COLUMN_NAME = 'year'
    ),
    'SELECT 1',
    'ALTER TABLE gxmu_yxgqty ADD COLUMN year INT NULL COMMENT ''年度'''
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
