initial commit

This commit is contained in:
2025-05-22 19:39:08 +08:00
commit 531bb42d01
103 changed files with 10291 additions and 0 deletions

13
sql/users.sql Normal file
View File

@ -0,0 +1,13 @@
-- 1. 用户表 DDL
CREATE TABLE users (
user_id UUID PRIMARY KEY DEFAULT gen_random_uuid(), -- 唯一用户 ID
username TEXT NOT NULL UNIQUE, -- 用户名
email TEXT UNIQUE, -- 邮箱
password_hash TEXT NOT NULL, -- 密码哈希
roles TEXT[] NOT NULL DEFAULT ARRAY[]::TEXT[], -- 角色列表
created_at TIMESTAMPTZ NOT NULL DEFAULT now() -- 创建时间
);
-- 为 username、email 建立索引,加速查询
CREATE INDEX idx_users_username ON users(username);
CREATE INDEX idx_users_email ON users(email);