mirror of
https://github.com/perfect-panel/ppanel-web.git
synced 2026-08-29 05:52:08 -04:00
add MySQL + PG down.sql
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
-- 000001_init_schema.down.sql
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
DROP TABLE IF EXISTS `user_subscribe_log`;
|
||||
DROP TABLE IF EXISTS `user_subscribe`;
|
||||
DROP TABLE IF EXISTS `user_login_log`;
|
||||
DROP TABLE IF EXISTS `user_gift_amount_log`;
|
||||
DROP TABLE IF EXISTS `user_device`;
|
||||
DROP TABLE IF EXISTS `user_commission_log`;
|
||||
DROP TABLE IF EXISTS `user_balance_log`;
|
||||
DROP TABLE IF EXISTS `user_auth_methods`;
|
||||
DROP TABLE IF EXISTS `user`;
|
||||
DROP TABLE IF EXISTS `traffic_log`;
|
||||
DROP TABLE IF EXISTS `ticket_follow`;
|
||||
DROP TABLE IF EXISTS `ticket`;
|
||||
DROP TABLE IF EXISTS `system`;
|
||||
DROP TABLE IF EXISTS `subscribe_type`;
|
||||
DROP TABLE IF EXISTS `subscribe_group`;
|
||||
DROP TABLE IF EXISTS `subscribe`;
|
||||
DROP TABLE IF EXISTS `sms`;
|
||||
DROP TABLE IF EXISTS `server_rule_group`;
|
||||
DROP TABLE IF EXISTS `server_group`;
|
||||
DROP TABLE IF EXISTS `server`;
|
||||
DROP TABLE IF EXISTS `payment`;
|
||||
DROP TABLE IF EXISTS `order`;
|
||||
DROP TABLE IF EXISTS `message_log`;
|
||||
DROP TABLE IF EXISTS `document`;
|
||||
DROP TABLE IF EXISTS `coupon`;
|
||||
DROP TABLE IF EXISTS `auth_method`;
|
||||
DROP TABLE IF EXISTS `application_version`;
|
||||
DROP TABLE IF EXISTS `application_config`;
|
||||
DROP TABLE IF EXISTS `application`;
|
||||
DROP TABLE IF EXISTS `announcement`;
|
||||
DROP TABLE IF EXISTS `ads`;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -0,0 +1,21 @@
|
||||
-- 000002_init_data.down.sql
|
||||
SET
|
||||
FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
DELETE
|
||||
FROM `auth_method`
|
||||
WHERE `id` IN (1, 2, 3, 4, 5, 6, 7, 8);
|
||||
DELETE
|
||||
FROM `payment`
|
||||
WHERE `id` = -1;
|
||||
DELETE
|
||||
FROM `subscribe_type`
|
||||
WHERE `id` IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14);
|
||||
DELETE
|
||||
FROM `system`
|
||||
WHERE `id` IN
|
||||
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
|
||||
31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41);
|
||||
|
||||
SET
|
||||
FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -0,0 +1,72 @@
|
||||
-- migrations/02003_update_payment.down.sql
|
||||
-- Purpose: Revert updates to payment and order tables
|
||||
-- Author: PPanel Team, 2025-04-21
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- Drop payment_id column from order table (if exists)
|
||||
SET @column_exists = (SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'order'
|
||||
AND COLUMN_NAME = 'payment_id');
|
||||
SET @sql = IF(@column_exists > 0,
|
||||
'ALTER TABLE `order` DROP COLUMN `payment_id`',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
-- Drop platform column from payment table (if exists)
|
||||
SET @column_exists = (SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'payment'
|
||||
AND COLUMN_NAME = 'platform');
|
||||
SET @sql = IF(@column_exists > 0,
|
||||
'ALTER TABLE `payment` DROP COLUMN `platform`',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
-- Drop description column from payment table (if exists)
|
||||
SET @column_exists = (SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'payment'
|
||||
AND COLUMN_NAME = 'description');
|
||||
SET @sql = IF(@column_exists > 0,
|
||||
'ALTER TABLE `payment` DROP COLUMN `description`',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
-- Drop token column from payment table (if exists)
|
||||
SET @column_exists = (SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'payment'
|
||||
AND COLUMN_NAME = 'token');
|
||||
SET @sql = IF(@column_exists > 0,
|
||||
'ALTER TABLE `payment` DROP COLUMN `token`',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
-- Optionally restore mark column (if needed, adjust definition as per original schema)
|
||||
SET @column_exists = (SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'payment'
|
||||
AND COLUMN_NAME = 'mark');
|
||||
SET @sql = IF(@column_exists = 0,
|
||||
'ALTER TABLE `payment` ADD COLUMN `mark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT \'Payment Mark\' AFTER `name`',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -0,0 +1,4 @@
|
||||
-- migrations/02003_rebuild_rule.up.sql
|
||||
-- Purpose: Back rebuilding server rule table
|
||||
-- Author: PPanel Team, 2025-04-21
|
||||
DROP TABLE IF EXISTS server_rule_group;
|
||||
@@ -0,0 +1,52 @@
|
||||
-- migrations/02004_create_user_device_online_record.down.sql
|
||||
-- Purpose: Drop user device online record table
|
||||
-- Author: PPanel Team, 2025-04-22
|
||||
|
||||
DROP TABLE IF EXISTS `user_device_online_record`;
|
||||
|
||||
-- User subscribe table migration for removing finished_at column
|
||||
SET @column_exists = (SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'user_subscribe'
|
||||
AND COLUMN_NAME = 'finished_at');
|
||||
SET @sql = IF(@column_exists > 0,
|
||||
'ALTER TABLE `user_subscribe` DROP COLUMN `finished_at`',
|
||||
'SELECT 1'
|
||||
);
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
-- Application config table migration for removing invitation_link column
|
||||
|
||||
SET @column_exists = (SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'application_config'
|
||||
AND COLUMN_NAME = 'invitation_link');
|
||||
|
||||
SET @sql = IF(@column_exists > 0,
|
||||
'ALTER TABLE `application_config` DROP COLUMN `invitation_link`',
|
||||
'SELECT 1'
|
||||
);
|
||||
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
-- Application config table migration for removing kr_website_id column
|
||||
SET @column_exists = (SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'application_config'
|
||||
AND COLUMN_NAME = 'kr_website_id');
|
||||
|
||||
SET @sql = IF(@column_exists > 0,
|
||||
'ALTER TABLE `application_config` DROP COLUMN `kr_website_id`',
|
||||
'SELECT 1'
|
||||
);
|
||||
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
@@ -0,0 +1,5 @@
|
||||
-- migrations/02008_create_user_reset_subscribe_log.down.sql
|
||||
-- Purpose: Drop user_reset_subscribe_log table
|
||||
-- Author: PPanel Team, 2025-04-22
|
||||
|
||||
DROP TABLE IF EXISTS `user_reset_subscribe_log`;
|
||||
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE `server_rule_group`
|
||||
DROP COLUMN `default`,
|
||||
DROP COLUMN `type`;
|
||||
@@ -0,0 +1 @@
|
||||
DROP TABLE IF EXISTS `email_task`;
|
||||
@@ -0,0 +1 @@
|
||||
DROP TABLE IF EXISTS `subscribe_application`;
|
||||
@@ -0,0 +1,106 @@
|
||||
CREATE TABLE IF NOT EXISTS `user_balance_log`
|
||||
(
|
||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||
`user_id` bigint NOT NULL COMMENT 'User ID',
|
||||
`amount` bigint NOT NULL COMMENT 'Amount',
|
||||
`type` tinyint(1) NOT NULL COMMENT 'Type: 1: Recharge 2: Withdraw 3: Payment 4: Refund 5: Reward',
|
||||
`order_id` bigint DEFAULT NULL COMMENT 'Order ID',
|
||||
`balance` bigint NOT NULL COMMENT 'Balance',
|
||||
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_user_id` (`user_id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `user_commission_log`
|
||||
(
|
||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||
`user_id` bigint NOT NULL COMMENT 'User ID',
|
||||
`order_no` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Order No.',
|
||||
`amount` bigint NOT NULL COMMENT 'Amount',
|
||||
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_user_id` (`user_id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `user_gift_amount_log`
|
||||
(
|
||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||
`user_id` bigint NOT NULL COMMENT 'User ID',
|
||||
`user_subscribe_id` bigint DEFAULT NULL COMMENT 'Deduction User Subscribe ID',
|
||||
`order_no` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Order No.',
|
||||
`type` tinyint(1) NOT NULL COMMENT 'Type: 1: Increase 2: Reduce',
|
||||
`amount` bigint NOT NULL COMMENT 'Amount',
|
||||
`balance` bigint NOT NULL COMMENT 'Balance',
|
||||
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Remark',
|
||||
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_user_id` (`user_id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `user_login_log`
|
||||
(
|
||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||
`user_id` bigint NOT NULL COMMENT 'User ID',
|
||||
`login_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Login IP',
|
||||
`user_agent` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'UserAgent',
|
||||
`success` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Login Success',
|
||||
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_user_id` (`user_id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `user_reset_subscribe_log`
|
||||
(
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
`user_id` BIGINT NOT NULL COMMENT 'User ID',
|
||||
`type` TINYINT(1) NOT NULL COMMENT 'Type: 1: Auto 2: Advance 3: Paid',
|
||||
`order_no` VARCHAR(255) DEFAULT NULL COMMENT 'Order No.',
|
||||
`user_subscribe_id` BIGINT NOT NULL COMMENT 'User Subscribe ID',
|
||||
`created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creation Time',
|
||||
INDEX `idx_user_id` (`user_id`),
|
||||
INDEX `idx_user_subscribe_id` (`user_subscribe_id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `user_subscribe_log`
|
||||
(
|
||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||
`user_id` bigint NOT NULL COMMENT 'User ID',
|
||||
`user_subscribe_id` bigint NOT NULL COMMENT 'User Subscribe ID',
|
||||
`token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Token',
|
||||
`ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'IP',
|
||||
`user_agent` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'UserAgent',
|
||||
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_user_id` (`user_id`),
|
||||
KEY `idx_user_subscribe_id` (`user_subscribe_id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `message_log`
|
||||
(
|
||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||
`type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'email' COMMENT 'Message Type',
|
||||
`platform` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'smtp' COMMENT 'Platform',
|
||||
`to` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'To',
|
||||
`subject` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Subject',
|
||||
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Content',
|
||||
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Status',
|
||||
`created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
|
||||
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci;
|
||||
|
||||
DROP TABLE IF EXISTS `system_logs`;
|
||||
@@ -0,0 +1,2 @@
|
||||
DROP TABLE IF EXISTS `nodes`;
|
||||
DROP TABLE IF EXISTS `servers`;
|
||||
@@ -0,0 +1,5 @@
|
||||
ALTER TABLE `subscribe`
|
||||
DROP COLUMN `nodes`,
|
||||
DROP COLUMN `node_tags`,
|
||||
ADD COLUMN `server` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'Server',
|
||||
ADD COLUMN `server_group` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'Server Group';
|
||||
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE `user`
|
||||
DROP COLUMN `referral_percentage`,
|
||||
DROP COLUMN `only_first_purchase`;
|
||||
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE `nodes`
|
||||
DROP COLUMN `sort`;
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX idx_traffic_log_time_user_sub ON traffic_log;
|
||||
@@ -0,0 +1,2 @@
|
||||
DROP TABLE IF EXISTS `subscribe_type`;
|
||||
DROP TABLE IF EXISTS `sms`;
|
||||
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE `user`
|
||||
DROP COLUMN `algo`,
|
||||
DROP COLUMN `salt`;
|
||||
@@ -0,0 +1,7 @@
|
||||
INSERT INTO `system` (`category`, `key`, `value`, `type`, `desc`, `created_at`, `updated_at`)
|
||||
SELECT 'site', 'CustomData', '{
|
||||
"kr_website_id": ""
|
||||
}', 'string', 'Custom Data', '2025-04-22 14:25:16.637', '2025-10-14 15:47:19.187'
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM `system` WHERE `category` = 'site' AND `key` = 'CustomData'
|
||||
);
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE traffic_log DROP INDEX idx_timestamp;
|
||||
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE `user_subscribe`
|
||||
DROP COLUMN `note`;
|
||||
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE `user`
|
||||
DROP COLUMN IF EXISTS `rules`;
|
||||
@@ -0,0 +1,5 @@
|
||||
DROP TABLE IF EXISTS `withdrawals`;
|
||||
|
||||
DELETE FROM `system`
|
||||
WHERE `category` = 'invite'
|
||||
AND `key` = 'WithdrawalMethod';
|
||||
@@ -0,0 +1,27 @@
|
||||
CREATE TABLE IF NOT EXISTS `server`
|
||||
(
|
||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Node Name',
|
||||
`tags` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Tags',
|
||||
`country` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Country',
|
||||
`city` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'City',
|
||||
`latitude` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'latitude',
|
||||
`longitude` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'longitude',
|
||||
`server_addr` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Server Address',
|
||||
`relay_mode` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'none' COMMENT 'Relay Mode',
|
||||
`relay_node` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Relay Node',
|
||||
`speed_limit` bigint NOT NULL DEFAULT '0' COMMENT 'Speed Limit',
|
||||
`traffic_ratio` decimal(4, 2) NOT NULL DEFAULT '0.00' COMMENT 'Traffic Ratio',
|
||||
`group_id` bigint DEFAULT NULL COMMENT 'Group ID',
|
||||
`protocol` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Protocol',
|
||||
`config` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Config',
|
||||
`enable` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Enabled',
|
||||
`sort` bigint NOT NULL DEFAULT '0' COMMENT 'Sort',
|
||||
`last_reported_at` datetime(3) DEFAULT NULL COMMENT 'Last Reported Time',
|
||||
`created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
|
||||
`updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_group_id` (`group_id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci;
|
||||
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE `subscribe`
|
||||
DROP COLUMN `show_original_price`;
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
-- This migration script reverts the inventory values in the 'subscribe' table
|
||||
UPDATE `subscribe`
|
||||
SET `inventory` = 0
|
||||
WHERE `inventory` = -1;
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX idx_type_date ON system_logs;
|
||||
@@ -0,0 +1,131 @@
|
||||
SET @index_exists = (SELECT COUNT(1)
|
||||
FROM INFORMATION_SCHEMA.STATISTICS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'nodes'
|
||||
AND INDEX_NAME = 'idx_nodes_port');
|
||||
SET @sql = IF(@index_exists > 0,
|
||||
'ALTER TABLE `nodes` DROP INDEX `idx_nodes_port`',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET @index_exists = (SELECT COUNT(1)
|
||||
FROM INFORMATION_SCHEMA.STATISTICS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'nodes'
|
||||
AND INDEX_NAME = 'idx_nodes_tags');
|
||||
SET @sql = IF(@index_exists > 0,
|
||||
'ALTER TABLE `nodes` DROP INDEX `idx_nodes_tags`',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET @index_exists = (SELECT COUNT(1)
|
||||
FROM INFORMATION_SCHEMA.STATISTICS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'nodes'
|
||||
AND INDEX_NAME = 'idx_nodes_address');
|
||||
SET @sql = IF(@index_exists > 0,
|
||||
'ALTER TABLE `nodes` DROP INDEX `idx_nodes_address`',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET @index_exists = (SELECT COUNT(1)
|
||||
FROM INFORMATION_SCHEMA.STATISTICS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'nodes'
|
||||
AND INDEX_NAME = 'idx_nodes_name');
|
||||
SET @sql = IF(@index_exists > 0,
|
||||
'ALTER TABLE `nodes` DROP INDEX `idx_nodes_name`',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET @index_exists = (SELECT COUNT(1)
|
||||
FROM INFORMATION_SCHEMA.STATISTICS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'servers'
|
||||
AND INDEX_NAME = 'idx_servers_address');
|
||||
SET @sql = IF(@index_exists > 0,
|
||||
'ALTER TABLE `servers` DROP INDEX `idx_servers_address`',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET @index_exists = (SELECT COUNT(1)
|
||||
FROM INFORMATION_SCHEMA.STATISTICS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'servers'
|
||||
AND INDEX_NAME = 'idx_servers_name');
|
||||
SET @sql = IF(@index_exists > 0,
|
||||
'ALTER TABLE `servers` DROP INDEX `idx_servers_name`',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET @index_exists = (SELECT COUNT(1)
|
||||
FROM INFORMATION_SCHEMA.STATISTICS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'payment'
|
||||
AND INDEX_NAME = 'idx_payment_name');
|
||||
SET @sql = IF(@index_exists > 0,
|
||||
'ALTER TABLE `payment` DROP INDEX `idx_payment_name`',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET @index_exists = (SELECT COUNT(1)
|
||||
FROM INFORMATION_SCHEMA.STATISTICS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'coupon'
|
||||
AND INDEX_NAME = 'idx_coupon_name');
|
||||
SET @sql = IF(@index_exists > 0,
|
||||
'ALTER TABLE `coupon` DROP INDEX `idx_coupon_name`',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET @index_exists = (SELECT COUNT(1)
|
||||
FROM INFORMATION_SCHEMA.STATISTICS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'user'
|
||||
AND INDEX_NAME = 'idx_user_refer_code');
|
||||
SET @sql = IF(@index_exists > 0,
|
||||
'ALTER TABLE `user` DROP INDEX `idx_user_refer_code`',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET @index_exists = (SELECT COUNT(1)
|
||||
FROM INFORMATION_SCHEMA.STATISTICS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'order'
|
||||
AND INDEX_NAME = 'idx_order_coupon');
|
||||
SET @sql = IF(@index_exists > 0,
|
||||
'ALTER TABLE `order` DROP INDEX `idx_order_coupon`',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
|
||||
SET @index_exists = (SELECT COUNT(1)
|
||||
FROM INFORMATION_SCHEMA.STATISTICS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'order'
|
||||
AND INDEX_NAME = 'idx_order_trade_no');
|
||||
SET @sql = IF(@index_exists > 0,
|
||||
'ALTER TABLE `order` DROP INDEX `idx_order_trade_no`',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
@@ -0,0 +1 @@
|
||||
DROP TABLE IF EXISTS `server_config_overrides`;
|
||||
@@ -0,0 +1,17 @@
|
||||
SET @column_exists = (
|
||||
SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'payment'
|
||||
AND COLUMN_NAME = 'sort'
|
||||
);
|
||||
|
||||
SET @sql = IF(
|
||||
@column_exists > 0,
|
||||
'ALTER TABLE `payment` DROP COLUMN `sort`',
|
||||
'SELECT 1'
|
||||
);
|
||||
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
@@ -0,0 +1 @@
|
||||
DELETE FROM `system` WHERE `category` = 'subscribe' AND `key` = 'ShowTutorial';
|
||||
@@ -0,0 +1 @@
|
||||
SELECT 1;
|
||||
Reference in New Issue
Block a user