feat: 实现用户注册功能,包括数据库表结构、gRPC 服务和业务逻辑

This commit is contained in:
fish
2026-03-28 20:11:54 +08:00
parent e4bb25d1ac
commit 4ff974439f
9 changed files with 529 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
-- 创建 user_main 表
CREATE TABLE IF NOT EXISTS user_main (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
deleted BOOLEAN DEFAULT false,
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- 创建 user_login_account 表
CREATE TABLE IF NOT EXISTS user_login_account (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID NOT NULL REFERENCES user_main(id),
account VARCHAR(255) NOT NULL,
deleted BOOLEAN DEFAULT false,
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UNIQUE(account)
);
-- 创建 user_login_password 表
CREATE TABLE IF NOT EXISTS user_login_password (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID NOT NULL REFERENCES user_main(id),
password VARCHAR(255) NOT NULL,
deleted BOOLEAN DEFAULT false,
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- 创建索引
CREATE INDEX IF NOT EXISTS idx_user_login_account_user_id ON user_login_account(user_id);
CREATE INDEX IF NOT EXISTS idx_user_login_account_account ON user_login_account(account);
CREATE INDEX IF NOT EXISTS idx_user_login_password_user_id ON user_login_password(user_id);