@@ -1,5 +1,37 @@
|
|||||||
-- Purpose: Rollback user-level speed limit overrides from user_subscribe
|
-- Purpose: Rollback user-level speed limit overrides from user_subscribe
|
||||||
|
|
||||||
ALTER TABLE `user_subscribe`
|
SET @column_exists = (
|
||||||
DROP COLUMN IF EXISTS `traffic_limit`,
|
SELECT COUNT(*)
|
||||||
DROP COLUMN IF EXISTS `speed_limit`;
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE()
|
||||||
|
AND TABLE_NAME = 'user_subscribe'
|
||||||
|
AND COLUMN_NAME = 'traffic_limit'
|
||||||
|
);
|
||||||
|
|
||||||
|
SET @sql = IF(
|
||||||
|
@column_exists = 1,
|
||||||
|
'ALTER TABLE `user_subscribe` DROP COLUMN `traffic_limit`',
|
||||||
|
'SELECT ''Column traffic_limit does not exist in user_subscribe table'''
|
||||||
|
);
|
||||||
|
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
|
||||||
|
SET @column_exists = (
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE()
|
||||||
|
AND TABLE_NAME = 'user_subscribe'
|
||||||
|
AND COLUMN_NAME = 'speed_limit'
|
||||||
|
);
|
||||||
|
|
||||||
|
SET @sql = IF(
|
||||||
|
@column_exists = 1,
|
||||||
|
'ALTER TABLE `user_subscribe` DROP COLUMN `speed_limit`',
|
||||||
|
'SELECT ''Column speed_limit does not exist in user_subscribe table'''
|
||||||
|
);
|
||||||
|
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ SET @column_exists = (
|
|||||||
|
|
||||||
SET @sql = IF(
|
SET @sql = IF(
|
||||||
@column_exists = 0,
|
@column_exists = 0,
|
||||||
'ALTER TABLE `user_subscribe` ADD COLUMN `speed_limit` int NOT NULL DEFAULT 0 COMMENT ''User-level speed limit override (Mbps, 0=use plan default)'' AFTER `upload`',
|
'ALTER TABLE `user_subscribe` ADD COLUMN `speed_limit` BIGINT NOT NULL DEFAULT 0 COMMENT ''User-level speed limit override (Mbps, 0=use plan default)'' AFTER `upload`',
|
||||||
'SELECT ''Column speed_limit already exists in user_subscribe table'''
|
'SELECT ''Column speed_limit already exists in user_subscribe table'''
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user