fix: some api bug
This commit is contained in:
@@ -9,7 +9,7 @@ CREATE TABLE players
|
||||
|
||||
-- [注意] 此字段为冗余缓存,通过消息队列与 shop_players 表保持一致
|
||||
shop_id BIGINT,
|
||||
gender bool default 1 not null ,
|
||||
gender bool default true not null ,
|
||||
tags TEXT[] DEFAULT ARRAY[]::TEXT[],
|
||||
games BIGINT[] DEFAULT ARRAY[]::BIGINT[],
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
|
||||
@@ -15,6 +15,6 @@ CREATE TABLE shop_players
|
||||
CREATE INDEX idx_shop_players_player ON shop_players (player_id) WHERE left_at IS NULL;
|
||||
CREATE INDEX idx_shop_players_shop_active ON shop_players (shop_id, joined_at DESC) WHERE left_at IS NULL;
|
||||
|
||||
-- [新增] 唯一索引:确保一个打手同一时间只能有一个主店铺
|
||||
-- 唯一索引:确保一个打手同一时间只能有一个主店铺
|
||||
CREATE UNIQUE INDEX idx_shop_players_one_primary
|
||||
ON shop_players (player_id) WHERE is_primary = TRUE AND left_at IS NULL;
|
||||
|
||||
@@ -38,6 +38,7 @@ CREATE TRIGGER trigger_sync_verifications
|
||||
FOR EACH ROW
|
||||
EXECUTE FUNCTION sync_user_verification_status();
|
||||
|
||||
|
||||
-- | 字段名 | 类型 | 技术含义 | 业务目的与设计思考 |
|
||||
-- | :--- | :--- | :--- | :--- |
|
||||
-- | **`id`** | BIGINT | **主键 (Primary Key)** | **这张认证申请单的唯一编号**。<br>后端代码在处理“审核通过”这个动作时,操作的是这个 ID(例如:`Approve(verificationId)`)。 |
|
||||
|
||||
@@ -21,9 +21,8 @@ CREATE TABLE users
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMPTZ,
|
||||
|
||||
CONSTRAINT chk_current_role CHECK (current_role IN ('consumer', 'player', 'owner', 'admin'))
|
||||
CONSTRAINT chk_current_role CHECK ("current_role" IN ('consumer', 'player', 'owner', 'admin'))
|
||||
);
|
||||
|
||||
-- 索引
|
||||
CREATE INDEX idx_users_phone ON users (phone) WHERE deleted_at IS NULL;
|
||||
CREATE INDEX idx_users_username_trgm ON users USING gin (username gin_trgm_ops) WHERE deleted_at IS NULL;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
CREATE TABLE wallets
|
||||
(
|
||||
user_id BIGINT PRIMARY KEY,
|
||||
balance DECIMAL(12, 2) NOT NULL DEFAULT 0.00,
|
||||
frozen_balance DECIMAL(12, 2) NOT NULL DEFAULT 0.00,
|
||||
balance DECIMAL(12, 2) NOT NULL DEFAULT 0.00, -- 可用余额
|
||||
frozen_balance DECIMAL(12, 2) NOT NULL DEFAULT 0.00, -- 冻结余额
|
||||
version INT NOT NULL DEFAULT 1, -- 必须使用乐观锁
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
|
||||
Reference in New Issue
Block a user