13 lines
781 B
SQL
13 lines
781 B
SQL
CREATE TABLE `wallet` (
|
|
`id` BIGINT(20) AUTO_INCREMENT NOT NULL COMMENT '錢包流水號',
|
|
`uid` VARCHAR(50) NOT NULL COMMENT '用戶ID',
|
|
`brand` VARCHAR(50) DEFAULT '' NOT NULL COMMENT '品牌名稱',
|
|
`currency` VARCHAR(20) NOT NULL COMMENT '幣別(或平台點數)',
|
|
`balance` DECIMAL(30, 18) UNSIGNED DEFAULT 0 NOT NULL COMMENT '錢包餘額',
|
|
`wallet_type` TINYINT NOT NULL COMMENT '錢包種類: 1=可用, 2=凍結, 3=限制(僅出金)',
|
|
`created_at` BIGINT NOT NULL COMMENT '創建時間',
|
|
`updated_at` BIGINT NOT NULL COMMENT '更新時間',
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE INDEX `uq_user_currency_type` (`uid`, `currency`, `wallet_type`),
|
|
INDEX `idx_user_currency` (`uid`, `currency`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用戶錢包'; |