chore: v1 整理 — 清理历史文件、DDL 合并、文档归档

- 清理 1155 个已删除的历史文件(废弃 prompt_logs、tmp、旧 ops 脚本)
- export/ 数据文件从 git 移除(已在 .gitignore)
- demo-miniprogram 从 tmp/ 移入 apps/,添加 CLAUDE.md 注解
- DDL 合并:完整 schema 定义填充到 db/*/schemas/(从 docs/database/ddl/ 复制)
- 39 个 v1 迁移脚本归档到 db/_archived/migrations_v1_merged/
- 4 个迁移变更类 BD_Manual 文档归档到 docs/database/_archived/
- .gitignore 补充 .vite/ 和 apps/*.zip
- settings.json 添加 effortLevel 默认配置
- scripts/ops/ 新增运维脚本入库

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Neo
2026-04-06 00:39:27 +08:00
parent 6f8f12314f
commit 779b2f6d52
1340 changed files with 9124 additions and 132087 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,99 @@
-- =============================================================================
-- etl_feiqiu / core跨门店标准化维度/事实)
-- 生成日期2026-04-05
-- 来源:测试库(通过脚本自动导出)
-- =============================================================================
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);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,77 @@
-- =============================================================================
-- etl_feiqiu / metaETL 调度元数据)
-- 生成日期2026-04-05
-- 来源:测试库(通过脚本自动导出)
-- =============================================================================
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);

File diff suppressed because it is too large Load Diff