guanghulab/persona-brain-db/schema/06-system-core-principles.sql

30 lines
1.6 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.

-- ============================================================
-- 表6system_core_principlesLayer 1 · 核心原则表·版本化)
-- 用途数据库OS内核级核心原则在init时创建并填充
-- D110更新添加shuangyan层 + axiom/meta_principle/cognitive_pattern类别
-- ============================================================
CREATE TABLE IF NOT EXISTS system_core_principles (
principle_id VARCHAR(32) PRIMARY KEY,
layer VARCHAR(16) NOT NULL
CHECK (layer IN ('bingshuo', 'zhuyuan', 'shuangyan', 'hololake', 'axiom')),
category VARCHAR(32) NOT NULL
CHECK (category IN (
'core_principle', 'thinking_pattern', 'tech_creed',
'communication_style', 'security_rule', 'development_spec',
'axiom', 'meta_principle', 'cognitive_pattern',
'fix_pattern', 'existence_premise'
)),
content TEXT NOT NULL,
version VARCHAR(16) NOT NULL,
status VARCHAR(16) NOT NULL DEFAULT 'active'
CHECK (status IN ('active', 'deprecated', 'superseded')),
superseded_by VARCHAR(32) REFERENCES system_core_principles(principle_id),
source TEXT,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX IF NOT EXISTS idx_scp_layer ON system_core_principles(layer);
CREATE INDEX IF NOT EXISTS idx_scp_category ON system_core_principles(category);
CREATE INDEX IF NOT EXISTS idx_scp_version ON system_core_principles(version);