
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ads` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Ads title',
  `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Ads type',
  `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Ads content',
  `target_url` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Ads target url',
  `start_time` datetime DEFAULT NULL COMMENT 'Ads start time',
  `end_time` datetime DEFAULT NULL COMMENT 'Ads end time',
  `status` tinyint(1) DEFAULT '0' COMMENT 'Ads status,0 disable,1 enable',
  `created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
  `updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
  `description` varchar(255) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Description',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `announcement` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Title',
  `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Content',
  `show` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Show',
  `pinned` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Pinned',
  `popup` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Popup',
  `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;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `auth_method` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'method',
  `config` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'OAuth Configuration',
  `enabled` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Is Enabled',
  `created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
  `updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uni_auth_method` (`method`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `coupon` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Coupon Name',
  `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Coupon Code',
  `count` bigint NOT NULL DEFAULT '0' COMMENT 'Count Limit',
  `type` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Coupon Type: 1: Percentage 2: Fixed Amount',
  `discount` bigint NOT NULL DEFAULT '0' COMMENT 'Coupon Discount',
  `start_time` bigint NOT NULL DEFAULT '0' COMMENT 'Start Time',
  `expire_time` bigint NOT NULL DEFAULT '0' COMMENT 'Expire Time',
  `user_limit` bigint NOT NULL DEFAULT '0' COMMENT 'User Limit',
  `subscribe` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Subscribe Limit',
  `used_count` bigint NOT NULL DEFAULT '0' COMMENT 'Used Count',
  `enable` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Enable',
  `created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
  `updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uni_coupon_code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `document` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Document Title',
  `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Document Content',
  `tags` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Document Tags',
  `show` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Show',
  `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;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `nodes` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Node Name',
  `tags` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Tags',
  `port` smallint unsigned NOT NULL DEFAULT '0' COMMENT 'Connect Port',
  `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Connect Address',
  `server_id` bigint NOT NULL DEFAULT '0' COMMENT 'Server ID',
  `protocol` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Protocol',
  `enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Enabled',
  `sort` int unsigned NOT NULL DEFAULT '0' COMMENT 'Sort',
  `created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
  `updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `order` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `parent_id` bigint DEFAULT NULL COMMENT 'Parent Order Id',
  `user_id` bigint NOT NULL DEFAULT '0' COMMENT 'User Id',
  `order_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Order No',
  `type` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Order Type: 1: Subscribe, 2: Renewal, 3: ResetTraffic, 4: Recharge',
  `quantity` bigint NOT NULL DEFAULT '1' COMMENT 'Quantity',
  `price` bigint NOT NULL DEFAULT '0' COMMENT 'Original price',
  `amount` bigint NOT NULL DEFAULT '0' COMMENT 'Order Amount',
  `gift_amount` bigint NOT NULL DEFAULT '0' COMMENT 'User Gift Amount',
  `discount` bigint NOT NULL DEFAULT '0' COMMENT 'Discount Amount',
  `coupon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Coupon',
  `coupon_discount` bigint NOT NULL DEFAULT '0' COMMENT 'Coupon Discount Amount',
  `commission` bigint NOT NULL DEFAULT '0' COMMENT 'Order Commission',
  `payment_id` bigint NOT NULL DEFAULT '-1' COMMENT 'Payment Id',
  `method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Payment Method',
  `fee_amount` bigint NOT NULL DEFAULT '0' COMMENT 'Fee Amount',
  `trade_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Trade No',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Order Status: 1: Pending, 2: Paid, 3:Close, 4: Failed, 5:Finished',
  `subscribe_id` bigint NOT NULL DEFAULT '0' COMMENT 'Subscribe Id',
  `subscribe_token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Renewal Subscribe Token',
  `is_new` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Is New Order',
  `created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
  `updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uni_order_order_no` (`order_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `payment` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Payment Name',
  `platform` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Payment Platform',
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Payment Description',
  `token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Payment Token',
  `icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Payment Icon',
  `domain` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Notification Domain',
  `config` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Payment Configuration',
  `fee_mode` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Fee Mode: 0: No Fee 1: Percentage 2: Fixed Amount 3: Percentage + Fixed Amount',
  `fee_percent` bigint DEFAULT '0' COMMENT 'Fee Percentage',
  `fee_amount` bigint DEFAULT '0' COMMENT 'Fixed Fee Amount',
  `enable` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Is Enabled',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `redemption_code` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'Primary Key',
  `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Redemption Code',
  `total_count` bigint NOT NULL DEFAULT '0' COMMENT 'Total Redemption Count',
  `used_count` bigint NOT NULL DEFAULT '0' COMMENT 'Used Redemption Count',
  `subscribe_plan` bigint NOT NULL DEFAULT '0' COMMENT 'Subscribe Plan',
  `unit_time` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'month' COMMENT 'Unit Time: day, month, quarter, half_year, year',
  `quantity` bigint NOT NULL DEFAULT '1' COMMENT 'Quantity',
  `status` tinyint NOT NULL DEFAULT '1' COMMENT 'Status: 1=enabled, 0=disabled',
  `created_at` datetime NOT NULL COMMENT 'Creation Time',
  `updated_at` datetime NOT NULL COMMENT 'Update Time',
  `deleted_at` datetime DEFAULT NULL COMMENT 'Deletion Time',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_code` (`code`),
  KEY `idx_deleted_at` (`deleted_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Redemption Code Table';
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `redemption_record` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'Primary Key',
  `redemption_code_id` bigint NOT NULL DEFAULT '0' COMMENT 'Redemption Code Id',
  `user_id` bigint NOT NULL DEFAULT '0' COMMENT 'User Id',
  `subscribe_id` bigint NOT NULL DEFAULT '0' COMMENT 'Subscribe Id',
  `unit_time` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'month' COMMENT 'Unit Time',
  `quantity` bigint NOT NULL DEFAULT '1' COMMENT 'Quantity',
  `redeemed_at` datetime NOT NULL COMMENT 'Redeemed Time',
  `created_at` datetime NOT NULL COMMENT 'Creation Time',
  PRIMARY KEY (`id`),
  KEY `idx_redemption_code_id` (`redemption_code_id`),
  KEY `idx_user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Redemption Record Table';
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `schema_migrations` (
  `version` bigint NOT NULL,
  `dirty` tinyint(1) NOT NULL,
  PRIMARY KEY (`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `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;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `servers` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Server Name',
  `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',
  `ratio` decimal(4,2) NOT NULL DEFAULT '0.00' COMMENT 'Traffic Ratio',
  `address` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Server Address',
  `sort` bigint NOT NULL DEFAULT '0' COMMENT 'Sort',
  `protocols` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Protocol',
  `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',
  `longitude` varchar(255) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'longitude',
  `latitude` varchar(255) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'latitude',
  `longitude_center` varchar(255) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'longitude center',
  `latitude_center` varchar(255) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'latitude center',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `subscribe` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Subscribe Name',
  `language` varchar(255) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Language',
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Subscribe Description',
  `unit_price` bigint NOT NULL DEFAULT '0' COMMENT 'Unit Price',
  `unit_time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Unit Time',
  `discount` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Discount',
  `replacement` bigint NOT NULL DEFAULT '0' COMMENT 'Replacement',
  `inventory` bigint NOT NULL DEFAULT '0' COMMENT 'Inventory',
  `traffic` bigint NOT NULL DEFAULT '0' COMMENT 'Traffic',
  `speed_limit` bigint NOT NULL DEFAULT '0' COMMENT 'Speed Limit',
  `device_limit` bigint NOT NULL DEFAULT '0' COMMENT 'Device Limit',
  `quota` bigint NOT NULL DEFAULT '0' COMMENT 'Quota',
  `show` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Show portal page',
  `sell` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Sell',
  `sort` bigint NOT NULL DEFAULT '0' COMMENT 'Sort',
  `deduction_ratio` bigint DEFAULT '0' COMMENT 'Deduction Ratio',
  `allow_deduction` tinyint(1) DEFAULT '1' COMMENT 'Allow deduction',
  `reset_cycle` bigint DEFAULT '0' COMMENT 'Reset Cycle: 0: No Reset, 1: 1st, 2: Monthly, 3: Yearly',
  `renewal_reset` tinyint(1) DEFAULT '0' COMMENT 'Renew Reset',
  `created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
  `show_original_price` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'display the original price: 0 not display, 1 display',
  `updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
  `nodes` varchar(255) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Node IDs',
  `node_tags` varchar(255) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Node Tags',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `subscribe_application` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Application Name',
  `icon` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Application Icon',
  `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Application Description',
  `scheme` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Application Scheme',
  `user_agent` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'User Agent',
  `is_default` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Is Default Application',
  `subscribe_template` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Subscribe Template',
  `output_format` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'yaml' COMMENT 'Output Format',
  `download_link` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Download Link',
  `created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
  `updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `system` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `category` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Category',
  `key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Key Name',
  `value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Key Value',
  `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Type',
  `desc` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Description',
  `created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
  `updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uni_system_key` (`key`),
  KEY `index_key` (`key`)
) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `system_logs` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `type` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Log Type: 1: Email Message 2: Mobile Message 3: Subscribe 4: Subscribe Traffic 5: Server Traffic 6: Login 7: Register 8: Balance 9: Commission 10: Reset Subscribe 11: Gift',
  `date` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Log Date',
  `object_id` bigint NOT NULL DEFAULT '0' COMMENT 'Object ID',
  `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Log Content',
  `created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
  PRIMARY KEY (`id`),
  KEY `idx_type` (`type`),
  KEY `idx_object_id` (`object_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `task` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `type` tinyint NOT NULL COMMENT 'Task Type',
  `scope` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Task Scope',
  `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Task Content',
  `status` tinyint NOT NULL DEFAULT '0' COMMENT 'Task Status: 0: Pending, 1: In Progress, 2: Completed, 3: Failed',
  `errors` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Task Errors',
  `total` bigint unsigned NOT NULL DEFAULT '0' COMMENT 'Total Number',
  `current` bigint unsigned NOT NULL DEFAULT '0' COMMENT 'Current Number',
  `created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
  `updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ticket` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'Title',
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Description',
  `user_id` bigint NOT NULL DEFAULT '0' COMMENT 'UserId',
  `status` tinyint(1) NOT NULL DEFAULT '1' 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;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ticket_follow` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `ticket_id` bigint NOT NULL DEFAULT '0' COMMENT 'TicketId',
  `from` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'From',
  `type` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Type: 1 text, 2 image',
  `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'Content',
  `created_at` datetime(3) DEFAULT NULL COMMENT 'Create Time',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `traffic_log` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `server_id` bigint NOT NULL COMMENT 'Server ID',
  `user_id` bigint NOT NULL COMMENT 'User ID',
  `subscribe_id` bigint NOT NULL COMMENT 'Subscription ID',
  `download` bigint DEFAULT '0' COMMENT 'Download Traffic',
  `upload` bigint DEFAULT '0' COMMENT 'Upload Traffic',
  `timestamp` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'Traffic Log Time',
  PRIMARY KEY (`id`),
  KEY `idx_subscribe_id` (`subscribe_id`),
  KEY `idx_server_id` (`server_id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_traffic_log_time_user_sub` (`timestamp`,`user_id`,`subscribe_id`),
  KEY `idx_timestamp` (`timestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `password` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'User Password',
  `algo` varchar(20) COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'Encryption Algorithm',
  `salt` varchar(20) COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'default' COMMENT 'Password Salt',
  `avatar` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT 'User Avatar',
  `balance` bigint DEFAULT '0' COMMENT 'User Balance',
  `telegram` bigint DEFAULT NULL COMMENT 'Telegram Account',
  `refer_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Referral Code',
  `referer_id` bigint DEFAULT NULL COMMENT 'Referrer ID',
  `commission` bigint DEFAULT '0' COMMENT 'Commission',
  `referral_percentage` tinyint unsigned NOT NULL DEFAULT '0' COMMENT 'Referral Percentage',
  `only_first_purchase` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Only First Purchase',
  `gift_amount` bigint DEFAULT '0' COMMENT 'User Gift Amount',
  `enable` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Is Account Enabled',
  `is_admin` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Is Admin',
  `valid_email` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Is Email Verified',
  `enable_email_notify` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Enable Email Notifications',
  `enable_telegram_notify` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Enable Telegram Notifications',
  `enable_balance_notify` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Enable Balance Change Notifications',
  `enable_login_notify` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Enable Login Notifications',
  `enable_subscribe_notify` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Enable Subscription Notifications',
  `enable_trade_notify` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Enable Trade Notifications',
  `created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
  `rules` text COLLATE utf8mb4_general_ci COMMENT 'User rules for subscription',
  `updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
  `deleted_at` datetime(3) DEFAULT NULL COMMENT 'Deletion Time',
  `is_del` bigint unsigned DEFAULT NULL COMMENT '1: Normal 0: Deleted',
  PRIMARY KEY (`id`),
  KEY `idx_referer` (`referer_id`),
  KEY `idx_refer_code` (`refer_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user_auth_methods` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `user_id` bigint NOT NULL COMMENT 'User ID',
  `auth_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Auth Type 1: apple 2: google 3: github 4: facebook 5: telegram 6: email 7: phone',
  `auth_identifier` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Auth Identifier',
  `verified` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Is Verified',
  `created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
  `updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
  PRIMARY KEY (`id`),
  UNIQUE KEY `idx_auth_identifier` (`auth_identifier`),
  KEY `idx_user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user_device` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `user_id` bigint NOT NULL COMMENT 'User ID',
  `subscribe_id` bigint DEFAULT NULL COMMENT 'Subscribe ID',
  `ip` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Device Ip.',
  `Identifier` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Device Identifier.',
  `short_code` varchar(255) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Short Code',
  `user_agent` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Device User Agent.',
  `online` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Online',
  `enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'EnableDeviceNumber',
  `created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
  `updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user_device_online_record` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `user_id` bigint NOT NULL COMMENT 'User ID',
  `identifier` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'Device Identifier',
  `online_time` datetime DEFAULT NULL COMMENT 'Online Time',
  `offline_time` datetime DEFAULT NULL COMMENT 'Offline Time',
  `online_seconds` bigint DEFAULT NULL COMMENT 'Offline Seconds',
  `duration_days` bigint DEFAULT NULL COMMENT 'Duration Days',
  `created_at` datetime DEFAULT NULL COMMENT 'Creation Time',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user_subscribe` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `user_id` bigint NOT NULL COMMENT 'User ID',
  `order_id` bigint NOT NULL COMMENT 'Order ID',
  `subscribe_id` bigint NOT NULL COMMENT 'Subscription ID',
  `start_time` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT 'Subscription Start Time',
  `expire_time` datetime(3) DEFAULT NULL COMMENT 'Subscription Expire Time',
  `finished_at` datetime DEFAULT NULL COMMENT 'Subscribe Finished Time',
  `traffic` bigint DEFAULT '0' COMMENT 'Traffic',
  `download` bigint DEFAULT '0' COMMENT 'Download Traffic',
  `upload` bigint DEFAULT '0' COMMENT 'Upload Traffic',
  `token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'Token',
  `uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'UUID',
  `status` tinyint(1) DEFAULT '0' COMMENT 'Subscription Status: 0: Pending 1: Active 2: Finished 3: Expired 4: Deducted',
  `note` varchar(500) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'User note for subscription',
  `created_at` datetime(3) DEFAULT NULL COMMENT 'Creation Time',
  `updated_at` datetime(3) DEFAULT NULL COMMENT 'Update Time',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uni_user_subscribe_token` (`token`),
  UNIQUE KEY `uni_user_subscribe_uuid` (`uuid`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_order_id` (`order_id`),
  KEY `idx_subscribe_id` (`subscribe_id`),
  KEY `idx_token` (`token`),
  KEY `idx_uuid` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `withdrawals` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'Primary Key',
  `user_id` bigint NOT NULL COMMENT 'User ID',
  `amount` bigint NOT NULL COMMENT 'Withdrawal Amount',
  `content` text COMMENT 'Withdrawal Content',
  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Withdrawal Status',
  `reason` varchar(500) NOT NULL DEFAULT '' COMMENT 'Rejection Reason',
  `created_at` datetime NOT NULL COMMENT 'Creation Time',
  `updated_at` datetime NOT NULL COMMENT 'Update Time',
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

