app-cloudep-trade-service/generate/database/mysql/20230626065705_create_trans...

20 lines
1.2 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 `transaction` (
`id` BIGINT(20) AUTO_INCREMENT NOT NULL COMMENT '交易流水號',
`tx_id` VARCHAR(200) NOT NULL COMMENT '交易 ID',
`order_id` VARCHAR(200) NOT NULL COMMENT '訂單 ID',
`brand` VARCHAR(50) NOT NULL COMMENT '品牌名稱',
`uid` VARCHAR(50) NOT NULL COMMENT '發起 UID',
`to_uid` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '接收方UID',
`type` TINYINT NOT NULL COMMENT '交易類型: 1=提現, 2=充值',
`business_type` TINYINT NOT NULL COMMENT '業務類型',
`currency` VARCHAR(20) NOT NULL COMMENT '幣種',
`amount` DECIMAL(30, 18) UNSIGNED DEFAULT 0 NOT NULL COMMENT '交易金額',
`balance` DECIMAL(30, 18) UNSIGNED DEFAULT 0 NOT NULL COMMENT '交易後餘額',
`before_balance` DECIMAL(30, 18) UNSIGNED DEFAULT 0 NOT NULL COMMENT '交易前餘額',
`status` TINYINT NOT NULL DEFAULT 0 COMMENT '結算狀態',
`create_time` BIGINT NOT NULL COMMENT '創建時間Unix 時間戳,毫秒)',
PRIMARY KEY (`id`),
UNIQUE INDEX `uk_order_id_type` (`order_id`, `type`),
INDEX `idx_uid` (`uid`),
INDEX `idx_order_id` (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用戶錢包交異動紀錄';