feat: 迁移订阅表字段,为用户认证方法添加软删除功能及索引,并调整 Docker Compose 中 MySQL 端口映射。
Build docker and publish / build (20.15.1) (push) Successful in 7m34s
Build docker and publish / build (20.15.1) (push) Successful in 7m34s
This commit is contained in:
@@ -1,7 +1,53 @@
|
||||
ALTER TABLE `subscribe`
|
||||
ADD COLUMN `nodes` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'Node IDs',
|
||||
ADD COLUMN `node_tags` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'Node Tags',
|
||||
DROP COLUMN `server`,
|
||||
DROP COLUMN `server_group`;
|
||||
-- Add nodes column if not exists
|
||||
SET @col_exists = (SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'subscribe'
|
||||
AND COLUMN_NAME = 'nodes');
|
||||
SET @sql = IF(@col_exists = 0,
|
||||
'ALTER TABLE `subscribe` ADD COLUMN `nodes` VARCHAR(255) NOT NULL DEFAULT '''' COMMENT ''Node IDs''',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
-- Add node_tags column if not exists
|
||||
SET @col_exists = (SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'subscribe'
|
||||
AND COLUMN_NAME = 'node_tags');
|
||||
SET @sql = IF(@col_exists = 0,
|
||||
'ALTER TABLE `subscribe` ADD COLUMN `node_tags` VARCHAR(255) NOT NULL DEFAULT '''' COMMENT ''Node Tags''',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
-- Drop server column if exists
|
||||
SET @col_exists = (SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'subscribe'
|
||||
AND COLUMN_NAME = 'server');
|
||||
SET @sql = IF(@col_exists > 0,
|
||||
'ALTER TABLE `subscribe` DROP COLUMN `server`',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
-- Drop server_group column if exists
|
||||
SET @col_exists = (SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'subscribe'
|
||||
AND COLUMN_NAME = 'server_group');
|
||||
SET @sql = IF(@col_exists > 0,
|
||||
'ALTER TABLE `subscribe` DROP COLUMN `server_group`',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
DROP TABLE IF EXISTS `server_rule_group`;
|
||||
|
||||
Reference in New Issue
Block a user