muse-agent-example/db/ddl/90-主仓ALTER摘录-V9V10V14V30.sql

40 lines
2.3 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.

-- 主仓 ALTER 摘录(只取触达 V1/V3/V5 三个 init 文件所建 20 表的语句,一字不改)
-- 口径(创始人拍板③ 2026-07-10):主仓表原样不改列;本文件各段出处逐一注明。
-- 未摘录说明:V9/V10/V14 等文件中"新建表"部分(planning_section、meta 治理 8 表、
-- knowledge RAGFlow 14 表、各 outbox 表)实验现阶段不用,暂缓建表,登记见 db/表映射.md。
-- ── 出自 sql/muse/V9__extend_content_real_api_schema.sql ──
ALTER TABLE muse_content_export_task
ADD COLUMN IF NOT EXISTS download_expires_at TIMESTAMP,
ADD COLUMN IF NOT EXISTS completed_at TIMESTAMP,
ADD COLUMN IF NOT EXISTS progress INT NOT NULL DEFAULT 0,
ADD COLUMN IF NOT EXISTS source_snapshot JSONB;
-- ── 出自 sql/muse/V10__extend_meta_real_api_schema.sql ──
CREATE UNIQUE INDEX uk_muse_meta_schema_version_active_schema_id
ON muse_meta_schema_version(tenant_id, schema_id)
WHERE active_flag = TRUE AND deleted = FALSE;
ALTER TABLE muse_meta_protection_node
ADD COLUMN IF NOT EXISTS node_type VARCHAR(64) NOT NULL DEFAULT 'system',
ADD COLUMN IF NOT EXISTS irreplaceable_reason TEXT,
ADD COLUMN IF NOT EXISTS permission_requirement JSONB,
ADD COLUMN IF NOT EXISTS audit_requirement JSONB,
ADD COLUMN IF NOT EXISTS shadow_to_canonical_boundary JSONB,
ADD COLUMN IF NOT EXISTS observability_metrics JSONB;
-- ── 出自 sql/muse/V14__extend_knowledge_ragflow_real_api_schema.sql ──
ALTER TABLE muse_knowledge_draft
ALTER COLUMN source_snapshot_id TYPE VARCHAR(128) USING source_snapshot_id::text;
ALTER TABLE muse_knowledge_draft
ALTER COLUMN authorization_snapshot_id TYPE VARCHAR(128) USING authorization_snapshot_id::text;
ALTER TABLE muse_knowledge_binding
ALTER COLUMN source_snapshot_id TYPE VARCHAR(128) USING source_snapshot_id::text;
ALTER TABLE muse_knowledge_binding
ALTER COLUMN authorization_snapshot_id TYPE VARCHAR(128) USING authorization_snapshot_id::text;
-- ── 出自 sql/muse/V30__widen_authorization_snapshot_id_to_varchar.sql ──
-- (同文件另有 muse_ai_suggestion 一条,该表实验未建,不摘)
ALTER TABLE muse_content_block_source_attribution
ALTER COLUMN authorization_snapshot_id TYPE VARCHAR(128) USING authorization_snapshot_id::text;