合并商品编号迁移

This commit is contained in:
yml
2026-06-08 20:12:18 +08:00
parent 494b2c068a
commit 830cfcf33d
4 changed files with 69 additions and 48 deletions
+10
View File
@@ -75,6 +75,7 @@ CREATE TABLE IF NOT EXISTS game_accounts (
-- 租号商品列表:用户发布的出租商品
CREATE TABLE IF NOT EXISTS rental_listings (
id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
listing_no VARCHAR(20) NOT NULL COMMENT '商品编号,格式yyyyMMddNNNN',
account_id BIGINT UNSIGNED NOT NULL COMMENT '关联的游戏账号ID',
owner_id BIGINT UNSIGNED NOT NULL COMMENT '号主ID',
price DECIMAL(12,2) NOT NULL DEFAULT 0.00 COMMENT '租金(元/小时)',
@@ -86,12 +87,21 @@ CREATE TABLE IF NOT EXISTS rental_listings (
published_at DATETIME NULL COMMENT '发布时间',
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE KEY uk_rental_listings_listing_no (listing_no),
KEY idx_rental_listings_account_id (account_id),
KEY idx_rental_listings_owner_id (owner_id),
KEY idx_rental_listings_filter (status, review_status, in_transaction, price),
KEY idx_rental_listings_published (status, review_status, published_at DESC)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='租号商品列表';
-- 商品编号日序列表:记录每天已分配的最大序号
CREATE TABLE IF NOT EXISTS listing_no_sequences (
biz_date CHAR(8) PRIMARY KEY COMMENT '业务日期yyyyMMdd',
next_seq INT NOT NULL DEFAULT 0 COMMENT '当日已分配最大序号',
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商品编号日序列表';
-- -------------------------------------------
-- 订单相关表
-- -------------------------------------------