chore: 文档与 IDE 配置整理

- .kiro/specs/ → docs/specs/(41 个历史需求 spec 迁移,移除 .config.kiro)
- CLAUDE.md 三层拆分:根文件精简 + apps/backend/CLAUDE.md + .claude/commands/
- 新增 /spec-close、/pre-change 两个工作流命令
- DDL 基线刷新(从测试库重新导出 11 个文件,dws 35→38 表,biz 18→21 表)
- BD_Manual → BD_manual 命名统一(48 个文件)
- 修复 3 处文档与数据库不一致(auth.users.status 默认值、scheduled_tasks 字段、RLS 视图数)
- 新增 BD_manual_public_rbac_tables.md(public schema 8 张 RBAC/工作流表)
- 合并 biz.trigger_jobs 文档(10→12 字段,归档独立文档)
- docs/database/README.md 索引更新

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Neo
2026-04-06 00:02:37 +08:00
parent 8228b3fa37
commit 70324d8542
185 changed files with 13595 additions and 1219 deletions

View File

@@ -1,6 +1,6 @@
-- =============================================================================
-- zqyy_app / public小程序业务表
-- 生成日期2026-03-15
-- 生成日期2026-04-05
-- 来源:测试库(通过脚本自动导出)
-- =============================================================================
@@ -24,7 +24,8 @@ CREATE TABLE public.admin_users (
site_id bigint NOT NULL,
is_active boolean DEFAULT true,
created_at timestamp with time zone DEFAULT now(),
updated_at timestamp with time zone DEFAULT now()
updated_at timestamp with time zone DEFAULT now(),
roles _text DEFAULT '{site_admin}'::text[] NOT NULL
);
CREATE TABLE public.approvals (
@@ -47,7 +48,8 @@ CREATE TABLE public.member_retention_clue (
recorded_by_name character varying(50),
recorded_at timestamp with time zone DEFAULT now() NOT NULL,
site_id bigint NOT NULL,
source character varying(20) DEFAULT 'manual'::character varying NOT NULL
source character varying(20) DEFAULT 'manual'::character varying NOT NULL,
is_hidden boolean DEFAULT false NOT NULL
);
CREATE TABLE public.permissions (
@@ -83,7 +85,11 @@ CREATE TABLE public.scheduled_tasks (
run_count integer DEFAULT 0,
last_status character varying(20),
created_at timestamp with time zone DEFAULT now(),
updated_at timestamp with time zone DEFAULT now()
updated_at timestamp with time zone DEFAULT now(),
min_run_interval_value integer DEFAULT 0 NOT NULL,
min_run_interval_unit character varying(20) DEFAULT 'minutes'::character varying NOT NULL,
last_success_at timestamp with time zone,
min_run_intervals jsonb DEFAULT '{}'::jsonb NOT NULL
);
CREATE TABLE public.task_execution_log (
@@ -101,7 +107,8 @@ CREATE TABLE public.task_execution_log (
error_log text,
summary jsonb,
created_at timestamp with time zone DEFAULT now(),
schedule_id uuid
schedule_id uuid,
config jsonb
);
CREATE TABLE public.task_queue (
@@ -198,20 +205,3 @@ CREATE INDEX idx_user_roles_site_id ON public.user_roles USING btree (site_id);
CREATE INDEX idx_users_mobile ON public.users USING btree (mobile);
CREATE INDEX idx_users_site_id ON public.users USING btree (site_id);
-- =============================================================================
-- 种子数据Web 管理后台默认管理员账号
-- 默认密码admin123bcrypt hashcost=12
-- 生产环境部署后务必立即修改密码
-- =============================================================================
INSERT INTO admin_users (username, password_hash, display_name, site_id, is_active)
VALUES (
'admin',
'$2b$12$2MTWlJKL0HTgHIkv5Rmpie2pQ9PkeJu0iciLbzPEpPcA94ZakIQzq',
'默认管理员',
1,
TRUE
)
ON CONFLICT (username) DO NOTHING;