涵盖(每条对应已存的审计记录): - AI 模块拆分:apps/backend/app/ai/apps -> prompts/(8 个 APP + app2a 派生) audit: 2026-04-20__ai-module-complete.md - admin-web AI 管理套件:AIDashboard / AIOperations / AIRunLogs / AITriggers / TriggerManager audit: 2026-04-21__admin-web-ai-management-suite.md - App2 财务洞察 prompt v3 -> v5.1 + 小程序 AI 接入(chat / board-finance) audit: 2026-04-22__app2_prompt_v5_1_and_miniprogram_ai_insight.md - App2 prewarm 全过滤器 + AI 触发器 cron reschedule audit: 2026-04-21__app2-finance-prewarm-all-filters.md migration: 20260420_ai_trigger_jobs_and_app2_prewarm.sql / 20260421_app2_prewarm_cron_reschedule.sql - AppType 联合类型对齐 + adminAiAppTypes.test.ts audit: 2026-04-30__admin_web_ai_app_type_alignment.md - DashScope tokens_used 提取修复 audit: 2026-04-30__backend_dashscope_tokens_used_extraction.md - App3 线索完整详情 prompt audit: 2026-05-01__backend_app3_full_detail_prompt.md - Runtime Context 沙箱(5-1~5-2 主线): - 后端 schema/service + admin_runtime_context / xcx_runtime_clock 两个 router - admin-web RuntimeContext.tsx + miniprogram runtime-clock.ts - migration: 20260501__runtime_context_sandbox.sql - tools/db/verify_admin_web_sandbox.py + verify_sandbox_end_to_end.py - database/changes: 7 份 sandbox_* 验证报告 - 飞球 DWS 修复:finance_area_daily 区域汇总 + task_engine 调整 + RLS 视图业务日上界(migration 20260502 + scripts/ops/gen_rls_business_date_migration.py) 合规: - .gitignore 启用 tmp/ 排除 - 不入仓:apps/etl/connectors/feiqiu/.env(API_TOKEN secret,本地修改保留) 待验证清单: - docs/audit/changes/2026-05-04__cumulative_baseline_pending_verification.md 每个主题的功能完整性 / 上线验证几乎都未收口,按优先级 P0~P3 逐一处理
100 lines
3.2 KiB
SQL
100 lines
3.2 KiB
SQL
-- =============================================================================
|
||
-- etl_feiqiu / core(跨门店标准化维度/事实)
|
||
-- 生成日期:2026-05-02
|
||
-- 来源:测试库(通过脚本自动导出)
|
||
-- =============================================================================
|
||
|
||
CREATE SCHEMA IF NOT EXISTS core;
|
||
|
||
-- 表
|
||
CREATE TABLE core.dim_assistant (
|
||
assistant_id bigint NOT NULL,
|
||
tenant_id bigint NOT NULL,
|
||
site_id bigint NOT NULL,
|
||
real_name text NOT NULL,
|
||
nickname text,
|
||
mobile text,
|
||
level integer,
|
||
assistant_status integer,
|
||
leave_status integer
|
||
);
|
||
|
||
CREATE TABLE core.dim_goods_category (
|
||
category_id bigint NOT NULL,
|
||
tenant_id bigint NOT NULL,
|
||
category_name text NOT NULL,
|
||
parent_id bigint,
|
||
level integer
|
||
);
|
||
|
||
CREATE TABLE core.dim_member (
|
||
member_id bigint NOT NULL,
|
||
system_member_id bigint,
|
||
tenant_id bigint NOT NULL,
|
||
register_site_id bigint NOT NULL,
|
||
mobile text,
|
||
nickname text,
|
||
member_card_grade_name text,
|
||
status integer
|
||
);
|
||
|
||
CREATE TABLE core.dim_site (
|
||
site_id bigint NOT NULL,
|
||
tenant_id bigint NOT NULL,
|
||
shop_name text NOT NULL,
|
||
site_label text,
|
||
shop_status integer,
|
||
site_id_alias bigint
|
||
);
|
||
|
||
CREATE TABLE core.dim_table (
|
||
table_id bigint NOT NULL,
|
||
site_id bigint NOT NULL,
|
||
table_name text NOT NULL,
|
||
site_table_area_name text,
|
||
table_price numeric(18,2)
|
||
);
|
||
|
||
CREATE TABLE core.fact_payment (
|
||
payment_id bigint NOT NULL,
|
||
site_id bigint NOT NULL,
|
||
order_settle_id bigint,
|
||
pay_type integer,
|
||
pay_amount numeric(18,2),
|
||
pay_time timestamp with time zone,
|
||
status integer
|
||
);
|
||
|
||
CREATE TABLE core.fact_settlement (
|
||
order_settle_id bigint NOT NULL,
|
||
site_id bigint NOT NULL,
|
||
tenant_id bigint NOT NULL,
|
||
order_trade_no bigint,
|
||
member_id bigint,
|
||
total_amount numeric(18,2),
|
||
actual_amount numeric(18,2),
|
||
discount_amount numeric(18,2),
|
||
pay_status integer,
|
||
settle_time timestamp with time zone,
|
||
created_at timestamp with time zone,
|
||
updated_at timestamp with time zone
|
||
);
|
||
|
||
-- 约束(主键 / 唯一 / 外键)
|
||
ALTER TABLE core.dim_assistant ADD CONSTRAINT dim_assistant_pkey PRIMARY KEY (assistant_id);
|
||
ALTER TABLE core.dim_goods_category ADD CONSTRAINT dim_goods_category_pkey PRIMARY KEY (category_id);
|
||
ALTER TABLE core.dim_member ADD CONSTRAINT dim_member_pkey PRIMARY KEY (member_id);
|
||
ALTER TABLE core.dim_site ADD CONSTRAINT dim_site_pkey PRIMARY KEY (site_id);
|
||
ALTER TABLE core.dim_table ADD CONSTRAINT dim_table_pkey PRIMARY KEY (table_id);
|
||
ALTER TABLE core.fact_payment ADD CONSTRAINT fact_payment_pkey PRIMARY KEY (payment_id);
|
||
ALTER TABLE core.fact_settlement ADD CONSTRAINT fact_settlement_pkey PRIMARY KEY (order_settle_id);
|
||
|
||
-- 索引
|
||
CREATE INDEX idx_core_assistant_site ON core.dim_assistant USING btree (site_id);
|
||
CREATE INDEX idx_core_member_site ON core.dim_member USING btree (register_site_id);
|
||
CREATE INDEX idx_core_table_site ON core.dim_table USING btree (site_id);
|
||
CREATE INDEX idx_core_payment_site ON core.fact_payment USING btree (site_id);
|
||
CREATE INDEX idx_core_settlement_site ON core.fact_settlement USING btree (site_id);
|
||
CREATE INDEX idx_core_settlement_time ON core.fact_settlement USING btree (settle_time);
|
||
|