puzhibing
4 天以前 a0e03b646f2c444b0f09687d24e9995112b99017
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
SET @column_exists := (
    SELECT COUNT(1)
    FROM information_schema.COLUMNS
    WHERE TABLE_SCHEMA = DATABASE()
      AND TABLE_NAME = 't_partner'
      AND COLUMN_NAME = 'venue_share_amount'
);
 
SET @ddl := IF(
    @column_exists = 0,
    'ALTER TABLE `t_partner` ADD COLUMN `venue_share_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT ''场地方合作商分账金额(元)'' AFTER `service_share_ratio`',
    'SELECT 1'
);
 
PREPARE stmt FROM @ddl;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;