
-- 用户表
CREATE TABLE `user` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `union_id` varchar(128) NOT NULL COMMENT '微信唯一标识id',
  `ma_open_id` varchar(128) NOT NULL COMMENT '微信用户小程序标识id',
  `mp_open_id` varchar(128) DEFAULT NULL COMMENT '微信用户服务号标识id',
  `nickname` varchar(100) NOT NULL COMMENT '用户昵称',
  `created_by` bigint NOT NULL COMMENT '创建人',
  `creation_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `last_updated_by` bigint NOT NULL COMMENT '最后更新人',
  `last_update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
  `version` bigint NOT NULL DEFAULT '1' COMMENT '版本号',
  `delete_flag` tinyint NOT NULL DEFAULT '0' COMMENT '逻辑删除标志（0-未删除，1-已删除）',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户表';

-- 系统字典表
CREATE TABLE `sys_dict` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `dict_code` varchar(100) NOT NULL COMMENT '字典编码',
  `dict_name` varchar(100) NOT NULL COMMENT '字典名称',
  `description` varchar(200) DEFAULT NULL COMMENT '描述',
  `status` int NOT NULL DEFAULT 1 COMMENT '状态(1-启用，0-失效)',
  `created_by` bigint NOT NULL COMMENT '创建人',
  `creation_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `last_updated_by` bigint NOT NULL COMMENT '最后更新人',
  `last_update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
  `version` bigint NOT NULL DEFAULT '1' COMMENT '版本号',
  `delete_flag` tinyint NOT NULL DEFAULT '0' COMMENT '逻辑删除标志（0-未删除，1-已删除）',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='系统字典表';

-- 系统字典项表
CREATE TABLE `sys_dict_item` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `dict_id` bigint NOT NULL COMMENT '字典表主键',
  `data_type` int NOT NULL COMMENT '数据类型（0-String，1-Number）',
  `item_code` varchar(100) NOT NULL COMMENT '字典项编码',
  `item_name` varchar(100) NOT NULL COMMENT '字典项名称',
  `description` varchar(200) DEFAULT NULL COMMENT '描述',
  `status` int NOT NULL DEFAULT 1 COMMENT '状态(1-启用，0-失效)',
  `created_by` bigint NOT NULL COMMENT '创建人',
  `creation_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `last_updated_by` bigint NOT NULL COMMENT '最后更新人',
  `last_update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
  `version` bigint NOT NULL DEFAULT '1' COMMENT '版本号',
  `delete_flag` tinyint NOT NULL DEFAULT '0' COMMENT '逻辑删除标志（0-未删除，1-已删除）',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='系统字典项表';

-- Product Hunt数据表
CREATE TABLE `data_product_hunt_post` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `rank_date` date NOT NULL COMMENT '榜单日期',
  `rank_num` int NOT NULL COMMENT '排名位置',
  `post_id` bigint NOT NULL COMMENT '帖子ID',
  `name` varchar(200) NOT NULL COMMENT '帖子名称',
  `tagline` varchar(300) DEFAULT NULL COMMENT '帖子的标语',
  `description` varchar(1000) DEFAULT NULL COMMENT '帖子信息',
  `votesCount` int DEFAULT 0 COMMENT '投票数',
  `createdAt` timestamp DEFAULT NULL COMMENT '帖子的创建日期和时间',
  `featuredAt` timestamp DEFAULT NULL COMMENT '帖子被特色展示的日期和时间',
  `website` varchar(500) DEFAULT NULL COMMENT '指向该帖子网站的重定向 URL',
  `url` varchar(500) DEFAULT NULL COMMENT '帖子URL',
  `created_by` bigint NOT NULL COMMENT '创建人',
  `creation_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `last_updated_by` bigint NOT NULL COMMENT '最后更新人',
  `last_update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
  `version` bigint NOT NULL DEFAULT '1' COMMENT '版本号',
  `delete_flag` tinyint NOT NULL DEFAULT '0' COMMENT '逻辑删除标志（0-未删除，1-已删除）',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Product Hunt榜单的帖子数据';

-- 大乐透数据表
CREATE TABLE `data_da_le_tou` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `number` varchar(30) NOT NULL COMMENT '开奖号码，以竖杠隔开',
  `number1` varchar(2) DEFAULT NULL COMMENT '特别号码1，第一个尾号',
  `number2` varchar(2) DEFAULT NULL COMMENT '特别号码2，第二个尾号',
  `qihao` char(5) NOT NULL COMMENT '期号',
  `time` date DEFAULT NULL COMMENT '开奖日期',
  `no1num` int NOT NULL DEFAULT 0 COMMENT '一等奖注数',
  `no2num` int NOT NULL DEFAULT 0 COMMENT '二等奖注数',
  `no3num` int NOT NULL DEFAULT 0 COMMENT '三等奖注数',
  `no4num` int NOT NULL DEFAULT 0 COMMENT '四等奖注数',
  `no5num` int NOT NULL DEFAULT 0 COMMENT '五等奖注数',
  `no6num` int NOT NULL DEFAULT 0 COMMENT '六等奖注数',
  `no7num` int NOT NULL DEFAULT 0 COMMENT '七等奖注数',
  `no8num` int NOT NULL DEFAULT 0 COMMENT '八等奖注数',
  `no9num` int NOT NULL DEFAULT 0 COMMENT '九等奖注数',
  `no1money` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '一等奖金额',
  `no2money` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '二等奖金额',
  `no3money` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '三等奖金额',
  `no4money` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '四等奖金额',
  `no5money` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '五等奖金额',
  `no6money` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '六等奖金额',
  `no7money` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '七等奖金额',
  `no8money` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '八等奖金额',
  `no9money` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '九等奖金额',
  `name` varchar(30) DEFAULT NULL COMMENT '彩票名称',
  `xiaoshou` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '销售额',
  `jiangchi` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '奖池金额',
  `endtime` timestamp DEFAULT NULL COMMENT '截止兑奖时间',
  `no1numjia` int NOT NULL DEFAULT 0 COMMENT '一等奖追加注数',
  `no1moneyjia` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '一等奖追加奖金',
  `no2numjia` int NOT NULL DEFAULT 0 COMMENT '二等奖追加注数',
  `no2moneyjia` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '二等奖追加奖金',
  `created_by` bigint NOT NULL COMMENT '创建人',
  `creation_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `last_updated_by` bigint NOT NULL COMMENT '最后更新人',
  `last_update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
  `version` bigint NOT NULL DEFAULT '1' COMMENT '版本号',
  `delete_flag` tinyint NOT NULL DEFAULT '0' COMMENT '逻辑删除标志（0-未删除，1-已删除）',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='大乐透数据表';

-- 双色球数据表
CREATE TABLE `data_shuang_se_qiu` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `number` varchar(30) NOT NULL COMMENT '开奖号码，以竖杠隔开',
  `number1` varchar(2) DEFAULT NULL COMMENT '特别号码，尾号',
  `qihao` char(8) NOT NULL COMMENT '期号',
  `time` varchar(15) DEFAULT NULL COMMENT '开奖日期',
  `no1num` int NOT NULL DEFAULT 0 COMMENT '一等奖注数',
  `no2num` int NOT NULL DEFAULT 0 COMMENT '二等奖注数',
  `no3num` int NOT NULL DEFAULT 0 COMMENT '三等奖注数',
  `no4num` int NOT NULL DEFAULT 0 COMMENT '四等奖注数',
  `no5num` int NOT NULL DEFAULT 0 COMMENT '五等奖注数',
  `no6num` int NOT NULL DEFAULT 0 COMMENT '六等奖注数',
  `no1money` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '一等奖金额',
  `no2money` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '二等奖金额',
  `no3money` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '三等奖金额',
  `no4money` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '四等奖金额',
  `no5money` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '五等奖金额',
  `no6money` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '六等奖金额',
  `name` varchar(30) DEFAULT NULL COMMENT '彩票名称',
  `xiaoshou` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '销售额',
  `jiangchi` decimal(18,2) NOT NULL DEFAULT 0.00 COMMENT '奖池金额',
  `no1msg` varchar(1000) DEFAULT NULL COMMENT '一等奖中奖地域',
  `created_by` bigint NOT NULL COMMENT '创建人',
  `creation_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `last_updated_by` bigint NOT NULL COMMENT '最后更新人',
  `last_update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
  `version` bigint NOT NULL DEFAULT '1' COMMENT '版本号',
  `delete_flag` tinyint NOT NULL DEFAULT '0' COMMENT '逻辑删除标志（0-未删除，1-已删除）',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='双色球数据表';

-- 新股数据表
CREATE TABLE `data_ipo_stock` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `stock_code` varchar(10) NOT NULL COMMENT '股票代码',
  `stock_short_name` varchar(30) NOT NULL COMMENT '股票简称',
  `subscription_code` varchar(10) NOT NULL COMMENT '申购代码',
  `total_issued` decimal(22,4) NOT NULL DEFAULT 0.0000 COMMENT '发行总数',
  `online_issued` decimal(22,4) NOT NULL DEFAULT 0.0000 COMMENT '网上发行',
  `max_market_value_for_subscription` decimal(22,4) NOT NULL DEFAULT 0.0000 COMMENT '顶格申购需配市值',
  `subscription_limit` int NOT NULL DEFAULT 0 COMMENT '申购上限',
  `issue_price` decimal(20,2) NOT NULL DEFAULT 0.00 COMMENT '发行价格',
  `latest_price` decimal(20,2) NOT NULL DEFAULT 0.00 COMMENT '最新价',
  `first_day_closing_price` decimal(20,2) NOT NULL DEFAULT 0.00 COMMENT '首日收盘价',
  `subscription_date` date NOT NULL COMMENT '申购日期',
  `winning_number_announcement_date` date NOT NULL COMMENT '中签号公布日',
  `payment_date_for_winning` date NOT NULL COMMENT '中签缴款日期',
  `listing_date` date NOT NULL COMMENT '上市日期',
  `issue_p_e_ratio` decimal(5,2) NOT NULL DEFAULT 0.00 COMMENT '发行市盈率',
  `industry_p_e_ratio` decimal(5,2) NOT NULL DEFAULT 0.00 COMMENT '行业市盈率',
  `winning_rate` decimal(11,10) NOT NULL DEFAULT 0.0000000000 COMMENT '中签率',
  `cumulative_bid_multiple` decimal(20,2) NOT NULL DEFAULT 0.00 COMMENT '询价累计报价倍数',
  `bidding_firms_count` int NOT NULL DEFAULT 0 COMMENT '配售对象报价家数',
  `consecutive_limit_up_days` varchar(10) DEFAULT NULL COMMENT '连续一字板数量',
  `increase_rate` decimal(20,2) NOT NULL DEFAULT 0.00 COMMENT '涨幅',
  `profit_rer_winning_lot` decimal(20,2) NOT NULL DEFAULT 0.00 COMMENT '每中一签获利',
  `created_by` bigint NOT NULL COMMENT '创建人',
  `creation_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `last_updated_by` bigint NOT NULL COMMENT '最后更新人',
  `last_update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
  `version` bigint NOT NULL DEFAULT '1' COMMENT '版本号',
  `delete_flag` tinyint NOT NULL DEFAULT '0' COMMENT '逻辑删除标志（0-未删除，1-已删除）',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='新股数据表';

-- 新债数据表
CREATE TABLE `data_ipo_bond` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `bond_code` varchar(10) NOT NULL COMMENT '债券代码',
  `bond_short_name` varchar(30) NOT NULL COMMENT '债券简称',
  `announcement_date` date DEFAULT NULL COMMENT '公告日期',
  `issue_start_date` date DEFAULT NULL COMMENT '发行起始日',
  `issue_end_date` date DEFAULT NULL COMMENT '发行终止日',
  `planned_issue_amount` decimal(22,4) NOT NULL DEFAULT 0.0000 COMMENT '计划发行总量',
  `actual_issue_amount` decimal(22,4) NOT NULL DEFAULT 0.0000 COMMENT '实际发行总量',
  `issue_par_value` decimal(20,2) NOT NULL DEFAULT 0.00 COMMENT '发行面值',
  `issue_price` decimal(20,2) NOT NULL DEFAULT 0.00 COMMENT '发行价格',
  `issue_method` varchar(200) DEFAULT NULL COMMENT '发行方式',
  `issue_target` varchar(2000) DEFAULT NULL COMMENT '发行对象',
  `issue_scope` varchar(200) DEFAULT NULL COMMENT '发行范围',
  `underwriting_method` varchar(30) DEFAULT NULL COMMENT '承销方式',
  `fundraising_purpose` varchar(200) DEFAULT NULL COMMENT '募资用途说明',
  `initial_conversion_price` decimal(20,2) NOT NULL DEFAULT 0.00 COMMENT '初始转股价格',
  `conversion_start_date` date DEFAULT NULL COMMENT '转股开始日期',
  `conversion_end_date` date DEFAULT NULL COMMENT '转股终止日期',
  `online_subscription_date` date DEFAULT NULL COMMENT '网上申购日期',
  `online_subscription_code` varchar(10) DEFAULT NULL COMMENT '网上申购代码',
  `online_subscription_short_name` varchar(30) DEFAULT NULL COMMENT '网上申购简称',
  `online_subscription_max` decimal(20,2) NOT NULL DEFAULT 0.00 COMMENT '网上申购数量上限',
  `online_subscription_min` decimal(20,2) NOT NULL DEFAULT 0.00 COMMENT '网上申购数量下限',
  `online_subscription_unit` decimal(20,2) NOT NULL DEFAULT 0.00 COMMENT '网上申购单位',
  `online_subscription_result_date` date DEFAULT NULL COMMENT '网上申购中签结果公告日及退款日',
  `priority_subscription_date` date DEFAULT NULL COMMENT '优先申购日',
  `allotment_price` decimal(20,2) NOT NULL DEFAULT 0.00 COMMENT '配售价格',
  `creditor_registration_date` date DEFAULT NULL COMMENT '债权登记日',
  `priority_subscription_payment_date` date DEFAULT NULL COMMENT '优先申购缴款日',
  `conversion_code` varchar(10) DEFAULT NULL COMMENT '转股代码',
  `trading_market` varchar(30) DEFAULT NULL COMMENT '交易市场',
  `bond_name` varchar(100) DEFAULT NULL COMMENT '债券名称',
  `created_by` bigint NOT NULL COMMENT '创建人',
  `creation_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `last_updated_by` bigint NOT NULL COMMENT '最后更新人',
  `last_update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
  `version` bigint NOT NULL DEFAULT '1' COMMENT '版本号',
  `delete_flag` tinyint NOT NULL DEFAULT '0' COMMENT '逻辑删除标志（0-未删除，1-已删除）',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='新债数据表';


-- 定时任务执行记录表
CREATE TABLE `sys_schedule_task_log` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `task_code` varchar(100) NOT NULL COMMENT '定时任务编码',
  `task_name` varchar(100) NOT NULL COMMENT '定时任务名称',
  `launch_method` varchar(10) NOT NULL COMMENT '启动方式（AUTO-自动，MANUAL-手动）',
  `start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '任务开始时间',
  `end_time` timestamp DEFAULT NULL COMMENT '任务结束时间',
  `process_status` varchar(10) NOT NULL COMMENT '执行状态（RUNNING-执行中，SUCCESS-成功，FAIL-失败）',
  `created_by` bigint NOT NULL COMMENT '创建人',
  `creation_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `last_updated_by` bigint NOT NULL COMMENT '最后更新人',
  `last_update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
  `version` bigint NOT NULL DEFAULT '1' COMMENT '版本号',
  `delete_flag` tinyint NOT NULL DEFAULT '0' COMMENT '逻辑删除标志（0-未删除，1-已删除）',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='定时任务执行记录表';

-- 订阅源表
CREATE TABLE `subscription_source` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `title` varchar(100) NOT NULL COMMENT '主标题',
  `sub_title` varchar(300) DEFAULT NULL COMMENT '副标题',
  `push_channel` varchar(10) NOT NULL COMMENT '推送渠道（WXMP-微信服务号）',
  `push_frequency` varchar(100) NOT NULL COMMENT '推送频率',
  `description` varchar(1000) DEFAULT NULL COMMENT '详情描述',
  `pics` varchar(2000) DEFAULT NULL COMMENT '详情图片',
  `created_by` bigint NOT NULL COMMENT '创建人',
  `creation_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `last_updated_by` bigint NOT NULL COMMENT '最后更新人',
  `last_update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
  `version` bigint NOT NULL DEFAULT '1' COMMENT '版本号',
  `delete_flag` tinyint NOT NULL DEFAULT '0' COMMENT '逻辑删除标志（0-未删除，1-已删除）',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='订阅源表';

-- 订阅价格计划表
CREATE TABLE `subscription_plan` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `subscription_source_id` bigint NOT NULL COMMENT '订阅源ID',
  `paid_option` varchar(10) NOT NULL COMMENT '付费选项（FREE-免费、PAID-付费）',
  `subscription_price` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT '订阅价格（单位：元）',
  `subscription_duration` int NOT NULL COMMENT '订阅时长（单位：天）',
  `created_by` bigint NOT NULL COMMENT '创建人',
  `creation_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `last_updated_by` bigint NOT NULL COMMENT '最后更新人',
  `last_update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
  `version` bigint NOT NULL DEFAULT '1' COMMENT '版本号',
  `delete_flag` tinyint NOT NULL DEFAULT '0' COMMENT '逻辑删除标志（0-未删除，1-已删除）',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='订阅价格计划表';

-- 用户的订阅源配置表
CREATE TABLE `subscription_user_config` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `user_id` bigint NOT NULL COMMENT '用户ID',
  `subscription_source_id` bigint NOT NULL COMMENT '订阅源ID',
  `start_time` timestamp NOT NULL COMMENT '订阅开始时间',
  `end_time` timestamp NOT NULL COMMENT '订阅结束时间',
  `push_option` varchar(10) NOT NULL COMMENT '消息推送选项(ENABLE-开启、DISABLE-关闭)',
  `created_by` bigint NOT NULL COMMENT '创建人',
  `creation_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `last_updated_by` bigint NOT NULL COMMENT '最后更新人',
  `last_update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
  `version` bigint NOT NULL DEFAULT '1' COMMENT '版本号',
  `delete_flag` tinyint NOT NULL DEFAULT '0' COMMENT '逻辑删除标志（0-未删除，1-已删除）',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户的订阅源配置表';

-- 用户的订阅日志表
CREATE TABLE `subscription_user_log` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `user_id` bigint NOT NULL COMMENT '用户ID',
  `subscription_source_id` bigint NOT NULL COMMENT '订阅源ID',
  `subscription_plan_id` bigint NOT NULL COMMENT '订阅价格计划ID',
  `subscription_order_id` bigint NOT NULL COMMENT '订单ID',
  `paid_option` varchar(10) NOT NULL COMMENT '付费选项（FREE-免费、PAID-付费）',
  `subscription_price` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT '订阅价格（单位：元）',
  `subscription_duration` int NOT NULL COMMENT '本次订阅时长（单位：天）',
  `start_time` timestamp NOT NULL COMMENT '订阅前开始时间',
  `before_end_time` timestamp NOT NULL COMMENT '订阅前结束时间',
  `after_end_time` timestamp NOT NULL COMMENT '订阅后结束时间',
  `created_by` bigint NOT NULL COMMENT '创建人',
  `creation_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `last_updated_by` bigint NOT NULL COMMENT '最后更新人',
  `last_update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
  `version` bigint NOT NULL DEFAULT '1' COMMENT '版本号',
  `delete_flag` tinyint NOT NULL DEFAULT '0' COMMENT '逻辑删除标志（0-未删除，1-已删除）',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户的订阅日志表';

-- 订阅源与定时任务配置表
CREATE TABLE `subscription_task_config` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `task_code` varchar(30) NOT NULL COMMENT '定时任务编码',
  `task_name` varchar(100) NOT NULL COMMENT '定时任务名称',
  `subscription_source_id` bigint NOT NULL COMMENT '订阅源ID',
  `execute_option` varchar(10) NOT NULL COMMENT '执行选项(ENABLE-开启、DISABLE-关闭)',
  `created_by` bigint NOT NULL COMMENT '创建人',
  `creation_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `last_updated_by` bigint NOT NULL COMMENT '最后更新人',
  `last_update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
  `version` bigint NOT NULL DEFAULT '1' COMMENT '版本号',
  `delete_flag` tinyint NOT NULL DEFAULT '0' COMMENT '逻辑删除标志（0-未删除，1-已删除）',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='订阅源与定时任务配置表';

-- 订单表
CREATE TABLE `subscription_order` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `user_id` bigint NOT NULL COMMENT '用户ID',
  `subscription_source_id` bigint NOT NULL COMMENT '订阅源ID',
  `subscription_plan_id` bigint NOT NULL COMMENT '订阅价格计划ID',
  `order_no` varchar(15) NOT NULL COMMENT '订单号（格式：3位业务编码 + YYYYMMDD + 6位序列号）',
  `subscription_price` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT '订阅价格（单位：元）',
  `subscription_duration` int NOT NULL COMMENT '订阅时长（单位：天）',
  `payment_status` varchar(10) NOT NULL COMMENT '支付状态（NOTPAY-未支付，SUCCESS-支付成功、REFUND-转入退款、CLOSED-已关闭、REVOKED-已撤销）',
  `created_by` bigint NOT NULL COMMENT '创建人',
  `creation_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `last_updated_by` bigint NOT NULL COMMENT '最后更新人',
  `last_update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
  `version` bigint NOT NULL DEFAULT '1' COMMENT '版本号',
  `delete_flag` tinyint NOT NULL DEFAULT '0' COMMENT '逻辑删除标志（0-未删除，1-已删除）',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='订单表';

ALTER TABLE data_easy.sys_schedule_task_log ADD error_message varchar(300) NULL COMMENT '错误信息';
ALTER TABLE data_easy.sys_schedule_task_log CHANGE error_message error_message varchar(300) NULL COMMENT '错误信息' AFTER process_status;
ALTER TABLE data_easy.subscription_user_config MODIFY COLUMN push_option varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '消息推送选项(ENABLED-开启、DISABLED-关闭)';
ALTER TABLE data_easy.subscription_plan DROP COLUMN paid_option;
ALTER TABLE data_easy.subscription_source ADD COLUMN paid_option VARCHAR(10) NOT NULL COMMENT '付费选项（FREE-免费、PAID-付费）';
ALTER TABLE data_easy.subscription_source CHANGE paid_option paid_option varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '付费选项（FREE-免费、PAID-付费）' AFTER sub_title;
ALTER TABLE data_easy.subscription_source MODIFY COLUMN paid_option varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT 'PAID' NOT NULL COMMENT '付费选项（FREE-免费、PAID-付费）';
ALTER TABLE data_easy.subscription_order MODIFY COLUMN order_no varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '订单号（格式：3位业务编码 + YYYYMMDD + 3位序列号）';
ALTER TABLE data_easy.subscription_order MODIFY COLUMN order_no varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '订单号（格式：3位业务编码 + YYYYMMDD + 3位序列号）';
ALTER TABLE data_easy.sys_schedule_task_log MODIFY COLUMN error_message varchar(5000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '错误信息';
ALTER TABLE data_easy.data_ipo_bond MODIFY COLUMN planned_issue_amount decimal(22,4) DEFAULT 0.0000 NULL COMMENT '计划发行总量';
ALTER TABLE data_easy.data_ipo_bond MODIFY COLUMN actual_issue_amount decimal(22,4) DEFAULT 0.0000 NULL COMMENT '实际发行总量';
ALTER TABLE data_easy.data_ipo_bond MODIFY COLUMN issue_par_value decimal(20,2) DEFAULT 0.00 NULL COMMENT '发行面值';
ALTER TABLE data_easy.data_ipo_bond MODIFY COLUMN issue_price decimal(20,2) DEFAULT 0.00 NULL COMMENT '发行价格';
ALTER TABLE data_easy.data_ipo_bond MODIFY COLUMN initial_conversion_price decimal(20,2) DEFAULT 0.00 NULL COMMENT '初始转股价格';
ALTER TABLE data_easy.data_ipo_bond MODIFY COLUMN online_subscription_max decimal(20,2) DEFAULT 0.00 NULL COMMENT '网上申购数量上限';
ALTER TABLE data_easy.data_ipo_bond MODIFY COLUMN online_subscription_min decimal(20,2) DEFAULT 0.00 NULL COMMENT '网上申购数量下限';
ALTER TABLE data_easy.data_ipo_bond MODIFY COLUMN online_subscription_unit decimal(20,2) DEFAULT 0.00 NULL COMMENT '网上申购单位';
ALTER TABLE data_easy.data_ipo_bond MODIFY COLUMN allotment_price decimal(20,2) DEFAULT 0.00 NULL COMMENT '配售价格';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN total_issued decimal(22,4) DEFAULT 0.0000 NULL COMMENT '发行总数';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN online_issued decimal(22,4) DEFAULT 0.0000 NULL COMMENT '网上发行';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN max_market_value_for_subscription decimal(22,4) DEFAULT 0.0000 NULL COMMENT '顶格申购需配市值';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN subscription_limit int DEFAULT 0 NULL COMMENT '申购上限';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN issue_price decimal(20,2) DEFAULT 0.00 NULL COMMENT '发行价格';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN latest_price decimal(20,2) DEFAULT 0.00 NULL COMMENT '最新价';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN first_day_closing_price decimal(20,2) DEFAULT 0.00 NULL COMMENT '首日收盘价';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN subscription_date date NULL COMMENT '申购日期';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN winning_number_announcement_date date NULL COMMENT '中签号公布日';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN payment_date_for_winning date NULL COMMENT '中签缴款日期';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN listing_date date NULL COMMENT '上市日期';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN issue_p_e_ratio decimal(5,2) DEFAULT 0.00 NULL COMMENT '发行市盈率';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN industry_p_e_ratio decimal(5,2) DEFAULT 0.00 NULL COMMENT '行业市盈率';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN winning_rate decimal(11,10) DEFAULT 0.0000000000 NULL COMMENT '中签率';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN cumulative_bid_multiple decimal(20,2) DEFAULT 0.00 NULL COMMENT '询价累计报价倍数';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN bidding_firms_count int DEFAULT 0 NULL COMMENT '配售对象报价家数';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN increase_rate decimal(20,2) DEFAULT 0.00 NULL COMMENT '涨幅';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN profit_rer_winning_lot decimal(20,2) DEFAULT 0.00 NULL COMMENT '每中一签获利';
ALTER TABLE data_easy.data_product_hunt_post CHANGE createdAt created_at timestamp NULL COMMENT '帖子的创建日期和时间';
ALTER TABLE data_easy.data_product_hunt_post CHANGE featuredAt featured_at timestamp NULL COMMENT '帖子被特色展示的日期和时间';
ALTER TABLE data_easy.data_product_hunt_post CHANGE votesCount votes_count int DEFAULT 0 NULL COMMENT '投票数';
ALTER TABLE data_easy.`user` MODIFY COLUMN ma_open_id varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '微信用户小程序标识id';
ALTER TABLE data_easy.`user` MODIFY COLUMN nickname varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '用户昵称';
ALTER TABLE data_easy.subscription_order ADD close_time TIMESTAMP NOT NULL COMMENT '订单关闭时间';
ALTER TABLE data_easy.subscription_order CHANGE close_time close_time TIMESTAMP NOT NULL COMMENT '订单关闭时间' AFTER subscription_duration;
ALTER TABLE data_easy.data_product_hunt_post ADD `key` varchar(500) NULL COMMENT '关键词';
ALTER TABLE data_easy.data_product_hunt_post CHANGE `key` `key` varchar(500) NULL COMMENT '关键词' AFTER description;
ALTER TABLE data_easy.data_product_hunt_post ADD description_key varchar(500) NULL COMMENT '信息中的关键词';
ALTER TABLE data_easy.data_product_hunt_post CHANGE description_key description_key varchar(500) NULL COMMENT '信息中的关键词' AFTER description;
ALTER TABLE data_easy.subscription_task_config ADD page_path varchar(100) NULL COMMENT '页面路径';
ALTER TABLE data_easy.subscription_task_config CHANGE page_path page_path varchar(100) NULL COMMENT '页面路径' AFTER execute_option;
ALTER TABLE data_easy.subscription_task_config ADD template_id varchar(100) NULL COMMENT '消息模板ID';
ALTER TABLE data_easy.subscription_task_config CHANGE template_id template_id varchar(100) NULL COMMENT '消息模板ID' AFTER page_path;
ALTER TABLE data_easy.data_da_le_tou MODIFY COLUMN `time` char(10) NULL COMMENT '开奖日期';
ALTER TABLE data_easy.data_da_le_tou MODIFY COLUMN endtime char(19) NULL COMMENT '截止兑奖时间';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN subscription_code varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '申购代码';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN issue_p_e_ratio decimal(5,2) NULL COMMENT '发行市盈率';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN industry_p_e_ratio decimal(5,2) NULL COMMENT '行业市盈率';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN winning_rate decimal(11,10) NULL COMMENT '中签率';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN cumulative_bid_multiple decimal(20,2) NULL COMMENT '询价累计报价倍数';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN bidding_firms_count int NULL COMMENT '配售对象报价家数';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN increase_rate decimal(20,2) NULL COMMENT '涨幅';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN profit_rer_winning_lot decimal(20,2) NULL COMMENT '每中一签获利';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN first_day_closing_price decimal(20,2) NULL COMMENT '首日收盘价';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN latest_price decimal(20,2) NULL COMMENT '最新价';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN issue_price decimal(20,2) NULL COMMENT '发行价格';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN subscription_limit int NULL COMMENT '申购上限';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN max_market_value_for_subscription decimal(22,4) NULL COMMENT '顶格申购需配市值';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN online_issued decimal(22,4) NULL COMMENT '网上发行';
ALTER TABLE data_easy.data_ipo_stock MODIFY COLUMN total_issued decimal(22,4) NULL COMMENT '发行总数';
ALTER TABLE data_easy.data_ipo_bond MODIFY COLUMN allotment_price decimal(20,2) NULL COMMENT '配售价格';
ALTER TABLE data_easy.data_ipo_bond MODIFY COLUMN online_subscription_unit decimal(20,2) NULL COMMENT '网上申购单位';
ALTER TABLE data_easy.data_ipo_bond MODIFY COLUMN online_subscription_min decimal(20,2) NULL COMMENT '网上申购数量下限';
ALTER TABLE data_easy.data_ipo_bond MODIFY COLUMN online_subscription_max decimal(20,2) NULL COMMENT '网上申购数量上限';
ALTER TABLE data_easy.data_ipo_bond MODIFY COLUMN initial_conversion_price decimal(20,2) NULL COMMENT '初始转股价格';
ALTER TABLE data_easy.data_ipo_bond MODIFY COLUMN issue_price decimal(20,2) NULL COMMENT '发行价格';
ALTER TABLE data_easy.data_ipo_bond MODIFY COLUMN issue_par_value decimal(20,2) NULL COMMENT '发行面值';
ALTER TABLE data_easy.data_ipo_bond MODIFY COLUMN actual_issue_amount decimal(22,4) NULL COMMENT '实际发行总量';
ALTER TABLE data_easy.data_ipo_bond MODIFY COLUMN planned_issue_amount decimal(22,4) NULL COMMENT '计划发行总量';
ALTER TABLE data_easy.data_ipo_stock CHANGE profit_rer_winning_lot profit_per_winning_lot decimal(20,2) NULL COMMENT '每中一签获利';
ALTER TABLE data_easy.subscription_user_config CHANGE subscription_source_id subscription_source_code varchar(30) NOT NULL COMMENT '订阅源编码';
ALTER TABLE data_easy.subscription_user_config MODIFY COLUMN subscription_source_code varchar(30) NOT NULL COMMENT '订阅源编码';
ALTER TABLE data_easy.subscription_user_config CHANGE start_time start_date DATE NOT NULL COMMENT '订阅开始时间';
ALTER TABLE data_easy.subscription_user_config MODIFY COLUMN start_date DATE NOT NULL COMMENT '订阅开始时间';
ALTER TABLE data_easy.subscription_user_config CHANGE end_time end_date DATE NOT NULL COMMENT '订阅结束时间';
ALTER TABLE data_easy.subscription_user_config MODIFY COLUMN end_date DATE NOT NULL COMMENT '订阅结束时间';
ALTER TABLE data_easy.subscription_source ADD code varchar(30) NOT NULL COMMENT '唯一编码';
ALTER TABLE data_easy.subscription_source CHANGE code code varchar(30) NOT NULL COMMENT '唯一编码' AFTER id;
ALTER TABLE data_easy.subscription_user_log DROP COLUMN subscription_source_id;
ALTER TABLE data_easy.subscription_user_log DROP COLUMN subscription_plan_id;
ALTER TABLE data_easy.subscription_user_log DROP COLUMN subscription_price;
ALTER TABLE data_easy.subscription_user_log DROP COLUMN subscription_duration;
ALTER TABLE data_easy.subscription_user_log CHANGE start_time start_date DATE NOT NULL COMMENT '订阅前开始时间';
ALTER TABLE data_easy.subscription_user_log MODIFY COLUMN start_date DATE NOT NULL COMMENT '订阅前开始时间';
ALTER TABLE data_easy.subscription_user_log CHANGE before_end_time before_end_date DATE NULL COMMENT '订阅前结束时间';
ALTER TABLE data_easy.subscription_user_log MODIFY COLUMN before_end_date DATE NULL COMMENT '订阅前结束时间';
ALTER TABLE data_easy.subscription_user_log CHANGE after_end_time after_end_date DATE NOT NULL COMMENT '订阅后结束时间';
ALTER TABLE data_easy.subscription_user_log MODIFY COLUMN after_end_date DATE NOT NULL COMMENT '订阅后结束时间';
ALTER TABLE data_easy.subscription_order ADD transaction_id varchar(40) NULL COMMENT '微信支付订单号';
ALTER TABLE data_easy.subscription_order CHANGE transaction_id transaction_id varchar(40) NULL COMMENT '微信支付订单号' AFTER order_no;
ALTER TABLE data_easy.subscription_task_config MODIFY COLUMN subscription_source_id bigint NULL COMMENT '订阅源ID';
ALTER TABLE data_easy.subscription_task_config MODIFY COLUMN task_code varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '定时任务编码';
ALTER TABLE data_easy.subscription_order MODIFY COLUMN close_time DATETIME NOT NULL COMMENT '订单关闭时间';
ALTER TABLE data_easy.data_product_hunt_post DROP COLUMN key;

-- Product Hunt榜单的帖子媒体数据
CREATE TABLE `data_product_hunt_post_media` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `data_product_hunt_post_id` bigint NOT NULL COMMENT '帖子ID',
  `type` varchar(20) NOT NULL COMMENT '媒体类型',
  `url` varchar(500) NOT NULL COMMENT '图片url',
  `video_url` varchar(500) NOT NULL COMMENT '视频url',
  `created_by` bigint NOT NULL COMMENT '创建人',
  `creation_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `last_updated_by` bigint NOT NULL COMMENT '最后更新人',
  `last_update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
  `version` bigint NOT NULL DEFAULT '1' COMMENT '版本号',
  `delete_flag` tinyint NOT NULL DEFAULT '0' COMMENT '逻辑删除标志（0-未删除，1-已删除）',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Product Hunt榜单的帖子媒体数据';

ALTER TABLE data_easy.data_product_hunt_post_media CHANGE data_product_hunt_post_id post_id bigint NOT NULL COMMENT '帖子ID';
