Files
ssw-platform/packs/asset/schema/001_init.sql
T
admin ce30c5b2f6 feat(pack): 框架固定包 + 加模块一条命令(批次 12 + 12.5)
把「内核怎么知道有这个包」从手写改成生成,漏接直接报错而不是静默 404。

- crates/sspf-plugin:load_static() 收掉装配样板,bootstrap 的 load_packs 缩成一行

- 包统一出口:pub struct Pack + pub const DDLS(生成器不必理解各包常量命名)

- 业务 DDL 跟包走(packs/*/schema/*.sql 经 include_str! 编进二进制)

- packs_gen.rs / modules/mod.rs 5 段 / Cargo.toml / contract.md 三段改由 pack-sync.py 生成

- scripts/new-pack.sh:一条命令产出 5 个后端文件 + 接线 + 可选前端三件套

- scripts/verify.sh 静态闸门一键跑;.workbuddy 记忆与 HANDOFF 见下一提交
2026-11-01 23:04:53 +08:00

38 lines
1.8 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- asset_data_resource —— 数据资源(业务包自带的 DDL)。
--
-- 🔴 **DDL 跟着包走**(批次 12 交付物 ③):本文件在 `packs/asset/schema/` 下,
-- 由 `packs/asset/src/lib.rs` 用 `include_str!` **编译进二进制**
-- ⇒ 内核启动时按包顺序幂等执行 ⇒ 不再手抄进 `db/schema.sql`。
--
-- 🔴 **【集成期友好性】列名按官方规范写**(见官方
-- `jnpf-database/PostgreSQL/JNPF-PostgreSQL.sql` 的 `base_*` 表):
-- - `f_id VARCHAR(50)` —— 36 位 UUID(**不要限 32**);
-- - `f_tenant_id VARCHAR(50) DEFAULT '0' NOT NULL` —— **单租户也不许省**,
-- 官方 `base_*` 表全部带它,且参与复合主键 `(f_id, f_tenant_id)`;
-- - `f_delete_mark INTEGER DEFAULT 0` —— 软删标记。
--
-- 🔴 **列语义不许自创**:`f_name` / `f_category` / `f_scenario` / `f_provider`
-- / `f_format` / `f_scale` / `f_source` / `f_register_time` 取自公司本体
-- `DataResource`(`数据资源`),**列名与列序逐字对齐本体** ⇒ 后续接本体平台
-- 可直接映射,不用改表。
--
-- 🔴 **本文件只许建本包自己的表**,**不许建 `base_*`** —— 平台表的 DDL
-- 归 `db/schema.sql` 管(装载器会拦,见 `sspf-plugin` 的 `DdlTouchesBaseTable`)。
CREATE TABLE IF NOT EXISTS asset_data_resource (
f_id VARCHAR(50) NOT NULL,
f_name VARCHAR(200),
f_category VARCHAR(50),
f_scenario VARCHAR(500),
f_provider VARCHAR(200),
f_format VARCHAR(50),
f_scale VARCHAR(50),
f_source VARCHAR(50),
f_register_time TIMESTAMP(0) WITHOUT TIME ZONE,
f_creator_user_id VARCHAR(50),
f_creator_time TIMESTAMP(0) WITHOUT TIME ZONE,
f_delete_mark INTEGER DEFAULT 0,
f_tenant_id VARCHAR(50) DEFAULT '0' NOT NULL,
PRIMARY KEY (f_id, f_tenant_id)
);