- TypeScript项目基础架构 - API路由和账户管理服务 - 数据库模式和迁移 - 基础配置文件和文档 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
16 lines
645 B
SQL
16 lines
645 B
SQL
CREATE TABLE IF NOT EXISTS "accounts" (
|
|
"id" serial PRIMARY KEY NOT NULL,
|
|
"owner_id" varchar(128) NOT NULL,
|
|
"platform" varchar(100) NOT NULL,
|
|
"custom_id" varchar(255) NOT NULL,
|
|
"data" text NOT NULL,
|
|
"status" varchar(50) NOT NULL,
|
|
"notes" text,
|
|
"locked_at" timestamp,
|
|
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
"updated_at" timestamp DEFAULT now() NOT NULL
|
|
);
|
|
|
|
CREATE UNIQUE INDEX IF NOT EXISTS "platform_custom_id_idx" ON "accounts" ("platform","custom_id");
|
|
CREATE INDEX IF NOT EXISTS "owner_id_status_idx" ON "accounts" ("owner_id","status");
|
|
CREATE INDEX IF NOT EXISTS "platform_owner_idx" ON "accounts" ("platform","owner_id"); |