## P1 数据库基础 - zqyy_app: 创建 auth/biz schema、FDW 连接 etl_feiqiu - etl_feiqiu: 创建 app schema RLS 视图、商品库存预警表 - 清理 assistant_abolish 残留数据 ## P2 ETL/DWS 扩展 - 新增 DWS 助教订单贡献度表 (dws.assistant_order_contribution) - 新增 assistant_order_contribution_task 任务及 RLS 视图 - member_consumption 增加充值字段、assistant_daily 增加处罚字段 - 更新 ODS/DWD/DWS 任务文档及业务规则文档 - 更新 consistency_checker、flow_runner、task_registry 等核心模块 ## P3 小程序鉴权系统 - 新增 xcx_auth 路由/schema(微信登录 + JWT) - 新增 wechat/role/matching/application 服务层 - zqyy_app 鉴权表迁移 + 角色权限种子数据 - auth/dependencies.py 支持小程序 JWT 鉴权 ## 文档与审计 - 新增 DOCUMENTATION-MAP 文档导航 - 新增 7 份 BD_Manual 数据库变更文档 - 更新 DDL 基线快照(etl_feiqiu 6 schema + zqyy_app auth) - 新增全栈集成审计记录、部署检查清单更新 - 新增 BACKLOG 路线图、FDW→Core 迁移计划 ## Kiro 工程化 - 新增 5 个 Spec(P1/P2/P3/全栈集成/核心业务) - 新增审计自动化脚本(agent_on_stop/build_audit_context/compliance_prescan) - 新增 6 个 Hook(合规检查/会话日志/提交审计等) - 新增 doc-map steering 文件 ## 运维与测试 - 新增 ops 脚本:迁移验证/API 健康检查/ETL 监控/集成报告 - 新增属性测试:test_dws_contribution / test_auth_system - 清理过期 export 报告文件 - 更新 .gitignore 排除规则
78 lines
3.1 KiB
SQL
78 lines
3.1 KiB
SQL
-- =============================================================================
|
||
-- etl_feiqiu / meta(ETL 调度元数据)
|
||
-- 生成日期:2026-02-25
|
||
-- 来源:测试库(通过脚本自动导出)
|
||
-- =============================================================================
|
||
|
||
CREATE SCHEMA IF NOT EXISTS meta;
|
||
|
||
-- 序列
|
||
CREATE SEQUENCE IF NOT EXISTS meta.etl_cursor_cursor_id_seq AS bigint;
|
||
CREATE SEQUENCE IF NOT EXISTS meta.etl_run_run_id_seq AS bigint;
|
||
CREATE SEQUENCE IF NOT EXISTS meta.etl_task_task_id_seq AS bigint;
|
||
|
||
-- 表
|
||
CREATE TABLE meta.etl_cursor (
|
||
cursor_id bigint DEFAULT nextval('meta.etl_cursor_cursor_id_seq'::regclass) NOT NULL,
|
||
task_id bigint NOT NULL,
|
||
store_id bigint NOT NULL,
|
||
last_start timestamp with time zone,
|
||
last_end timestamp with time zone,
|
||
last_id bigint,
|
||
last_run_id bigint,
|
||
extra jsonb DEFAULT '{}'::jsonb,
|
||
created_at timestamp with time zone DEFAULT now(),
|
||
updated_at timestamp with time zone DEFAULT now()
|
||
);
|
||
|
||
CREATE TABLE meta.etl_run (
|
||
run_id bigint DEFAULT nextval('meta.etl_run_run_id_seq'::regclass) NOT NULL,
|
||
run_uuid text NOT NULL,
|
||
task_id bigint NOT NULL,
|
||
store_id bigint NOT NULL,
|
||
status text NOT NULL,
|
||
started_at timestamp with time zone DEFAULT now(),
|
||
ended_at timestamp with time zone,
|
||
window_start timestamp with time zone,
|
||
window_end timestamp with time zone,
|
||
window_minutes integer,
|
||
overlap_seconds integer,
|
||
fetched_count integer DEFAULT 0,
|
||
loaded_count integer DEFAULT 0,
|
||
updated_count integer DEFAULT 0,
|
||
skipped_count integer DEFAULT 0,
|
||
error_count integer DEFAULT 0,
|
||
unknown_fields integer DEFAULT 0,
|
||
export_dir text,
|
||
log_path text,
|
||
request_params jsonb DEFAULT '{}'::jsonb,
|
||
manifest jsonb DEFAULT '{}'::jsonb,
|
||
error_message text,
|
||
extra jsonb DEFAULT '{}'::jsonb
|
||
);
|
||
|
||
CREATE TABLE meta.etl_task (
|
||
task_id bigint DEFAULT nextval('meta.etl_task_task_id_seq'::regclass) NOT NULL,
|
||
task_code text NOT NULL,
|
||
store_id bigint NOT NULL,
|
||
enabled boolean DEFAULT true,
|
||
cursor_field text,
|
||
window_minutes_default integer DEFAULT 30,
|
||
overlap_seconds integer DEFAULT 600,
|
||
page_size integer DEFAULT 200,
|
||
retry_max integer DEFAULT 3,
|
||
params jsonb DEFAULT '{}'::jsonb,
|
||
created_at timestamp with time zone DEFAULT now(),
|
||
updated_at timestamp with time zone DEFAULT now()
|
||
);
|
||
|
||
-- 约束(主键 / 唯一 / 外键)
|
||
ALTER TABLE meta.etl_cursor ADD CONSTRAINT etl_cursor_task_id_fkey FOREIGN KEY (task_id) REFERENCES meta.etl_task(task_id) ON DELETE CASCADE;
|
||
ALTER TABLE meta.etl_cursor ADD CONSTRAINT etl_cursor_pkey PRIMARY KEY (cursor_id);
|
||
ALTER TABLE meta.etl_cursor ADD CONSTRAINT etl_cursor_task_id_store_id_key UNIQUE (task_id, store_id);
|
||
ALTER TABLE meta.etl_run ADD CONSTRAINT etl_run_task_id_fkey FOREIGN KEY (task_id) REFERENCES meta.etl_task(task_id) ON DELETE CASCADE;
|
||
ALTER TABLE meta.etl_run ADD CONSTRAINT etl_run_pkey PRIMARY KEY (run_id);
|
||
ALTER TABLE meta.etl_task ADD CONSTRAINT etl_task_pkey PRIMARY KEY (task_id);
|
||
ALTER TABLE meta.etl_task ADD CONSTRAINT etl_task_task_code_store_id_key UNIQUE (task_code, store_id);
|
||
|