guanghulab/persona-brain-db/schema/11-system-protocols.sql

24 lines
1.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.

-- ============================================================
-- 表11system_protocolsLayer 1 · 双协议层表)
-- 用途:存储双协议架构 — 光湖协议 + 国家规范协议
-- 协议层是数据库OS内核的一部分双面灯塔的通信规范
-- ============================================================
CREATE TABLE IF NOT EXISTS system_protocols (
protocol_id VARCHAR(64) PRIMARY KEY,
protocol_type VARCHAR(16) NOT NULL
CHECK (protocol_type IN ('guanghu', 'national', 'bridge')),
name VARCHAR(128) NOT NULL,
version VARCHAR(16) NOT NULL,
specification TEXT NOT NULL, -- 协议规范全文或引用
endpoint VARCHAR(256), -- 协议API端点
status VARCHAR(16) NOT NULL DEFAULT 'active'
CHECK (status IN ('active', 'draft', 'deprecated')),
compatible_with TEXT, -- JSON array of compatible versions
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX IF NOT EXISTS idx_sprot_type ON system_protocols(protocol_type);
CREATE INDEX IF NOT EXISTS idx_sprot_status ON system_protocols(status);