SET @traffic_limit_exists = (
  SELECT COUNT(*)
  FROM INFORMATION_SCHEMA.COLUMNS
  WHERE TABLE_SCHEMA = DATABASE()
    AND TABLE_NAME = 'user_subscribe'
    AND COLUMN_NAME = 'traffic_limit'
);

SET @traffic_limit_sql = IF(
  @traffic_limit_exists = 1,
  'ALTER TABLE `user_subscribe` DROP COLUMN `traffic_limit`',
  'SELECT 1'
);

PREPARE traffic_limit_stmt FROM @traffic_limit_sql;
EXECUTE traffic_limit_stmt;
DEALLOCATE PREPARE traffic_limit_stmt;

SET @speed_limit_exists = (
  SELECT COUNT(*)
  FROM INFORMATION_SCHEMA.COLUMNS
  WHERE TABLE_SCHEMA = DATABASE()
    AND TABLE_NAME = 'user_subscribe'
    AND COLUMN_NAME = 'speed_limit'
);

SET @speed_limit_sql = IF(
  @speed_limit_exists = 1,
  'ALTER TABLE `user_subscribe` DROP COLUMN `speed_limit`',
  'SELECT 1'
);

PREPARE speed_limit_stmt FROM @speed_limit_sql;
EXECUTE speed_limit_stmt;
DEALLOCATE PREPARE speed_limit_stmt;
