app-cloudep-trade-service/generate/database/mysql/20230913072305_create_walle...

19 lines
1.2 KiB
MySQL
Raw Permalink Normal View History

2024-10-29 08:17:31 +00:00
CREATE TABLE `wallet_journal` (
`id` BIGINT(20) AUTO_INCREMENT NOT NULL COMMENT '錢包賬本流水號',
`transaction_id` BIGINT(20) NOT NULL COMMENT '交易 ID對應 transaction 表',
`order_id` VARCHAR(200) NOT NULL COMMENT '訂單 ID對應 order 表',
`brand` VARCHAR(50) NOT NULL COMMENT '品牌名稱',
`uid` VARCHAR(50) NOT NULL COMMENT '用戶 ID',
`wallet_type` TINYINT NOT NULL COMMENT '餘額種類: 1=可用, 2=凍結, 3=限制(僅出金)',
`currency` VARCHAR(20) NOT NULL COMMENT '幣種或平台點數',
`transaction_amount` DECIMAL(30, 18) UNSIGNED DEFAULT 0 NOT NULL COMMENT '交易金額',
`post_transaction_balance` DECIMAL(30, 18) UNSIGNED DEFAULT 0 NOT NULL COMMENT '交易後餘額',
`business_type` TINYINT NOT NULL COMMENT '業務類型',
`status` TINYINT NOT NULL DEFAULT 0 COMMENT '狀態',
`due_time` BIGINT NOT NULL DEFAULT 0 COMMENT 'T+N 執行時間',
`created_at` BIGINT NOT NULL COMMENT '創建時間Unix 時間戳,毫秒)',
PRIMARY KEY (`id`),
KEY `idx_user_brand` (`uid`, `brand`),
KEY `idx_order_id` (`order_id`),
KEY `idx_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用戶錢包變動';