app-cloudep-wallet-service/generate/database/20230626063528_create_walle...

14 lines
920 B
SQL
Executable File
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 `wallet` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主鍵 ID錢包唯一識別',
`brand` VARCHAR(50) NOT NULL COMMENT '品牌/平台(多租戶識別)',
`uid` VARCHAR(64) NOT NULL COMMENT '使用者 UID',
`asset` VARCHAR(32) NOT NULL COMMENT '資產代碼(如 BTC、ETH、GEM_RED 等)',
`balance` DECIMAL(30, 18) UNSIGNED NOT NULL DEFAULT 0 COMMENT '資產餘額',
`type` TINYINT NOT NULL COMMENT '錢包類型',
`create_at` INTEGER NOT NULL DEFAULT 0 COMMENT '建立時間Unix',
`update_at` INTEGER NOT NULL DEFAULT 0 COMMENT '更新時間Unix',
PRIMARY KEY (`id`),
UNIQUE KEY `uq_brand_uid_asset_type` (`brand`, `uid`, `asset`, `type`),
KEY `idx_uid` (`uid`),
KEY `idx_brand` (`brand`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='錢包';