tydata-server/deploy/sql/query.sql
2025-01-10 00:09:25 +08:00

19 lines
1.6 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

CREATE TABLE `query` (
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`order_id` BIGINT NOT NULL COMMENT '订单ID软关联到订单表',
`user_id` BIGINT NOT NULL COMMENT '用户ID直接关联到用户',
`product_id` BIGINT NOT NULL COMMENT '产品ID直接关联到产品',
`query_params` TEXT NOT NULL COMMENT '查询params数据',
`query_data` LONGTEXT COMMENT '查询结果数据',
`query_state` ENUM('pending', 'success', 'failed') NOT NULL DEFAULT 'pending' COMMENT '查询状态',
`del_state` TINYINT NOT NULL DEFAULT '0' COMMENT '删除状态',
`version` BIGINT NOT NULL DEFAULT '0' COMMENT '版本号',
`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`delete_time` DATETIME DEFAULT NULL COMMENT '删除时间',
PRIMARY KEY (`id`),
UNIQUE KEY `unique_order_id` (`order_id`),
KEY `idx_user_id` (`user_id`),
KEY `idx_product_id` (`product_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='查询结果表,存储关联订单的查询数据';