添加 API 模块和更新忽略配置
This commit is contained in:
20
api/migrations/001_init.sql
Normal file
20
api/migrations/001_init.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
-- 初始化数据库
|
||||
-- 创建用户表
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name VARCHAR(100) NOT NULL,
|
||||
email VARCHAR(100) UNIQUE NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
|
||||
-- 创建索引
|
||||
CREATE INDEX IF NOT EXISTS idx_users_email ON users(email);
|
||||
CREATE INDEX IF NOT EXISTS idx_users_deleted_at ON users(deleted_at);
|
||||
|
||||
-- 插入测试数据
|
||||
INSERT INTO users (name, email) VALUES
|
||||
('张三', 'zhangsan@example.com'),
|
||||
('李四', 'lisi@example.com')
|
||||
ON CONFLICT (email) DO NOTHING;
|
||||
Reference in New Issue
Block a user