18 lines
617 B
SQL
18 lines
617 B
SQL
-- 联赛管理增加“热门联赛”配置字段,可重复执行。
|
|
SET @schema_name = DATABASE();
|
|
SET @has_is_hot = (
|
|
SELECT COUNT(*)
|
|
FROM information_schema.COLUMNS
|
|
WHERE TABLE_SCHEMA = @schema_name
|
|
AND TABLE_NAME = 'la_league'
|
|
AND COLUMN_NAME = 'is_hot'
|
|
);
|
|
SET @alter_sql = IF(
|
|
@has_is_hot = 0,
|
|
'ALTER TABLE `la_league` ADD COLUMN `is_hot` tinyint unsigned NOT NULL DEFAULT 0 COMMENT ''是否热门联赛: 0=否 1=是'' AFTER `is_show`',
|
|
'SELECT ''la_league.is_hot already exists'''
|
|
);
|
|
PREPARE alter_stmt FROM @alter_sql;
|
|
EXECUTE alter_stmt;
|
|
DEALLOCATE PREPARE alter_stmt;
|