| 123456789101112131415161718192021222324252627 |
- -- 灵越智报 v2.0 补充表结构(兼容 VARCHAR(36) ID 版本)
- -- PostgreSQL 15+
- -- 兼容 init.sql 中使用的 VARCHAR(36) ID 类型
- -- ============================================
- -- 6. 文本存储路径表(text_storage)
- -- 仅创建核心需要的表
- -- ============================================
- CREATE TABLE IF NOT EXISTS text_storage (
- id VARCHAR(36) PRIMARY KEY DEFAULT replace(gen_random_uuid()::text, '-', ''),
- document_id VARCHAR(36) NOT NULL REFERENCES documents(id) ON DELETE CASCADE,
- file_path VARCHAR(500) NOT NULL,
- file_size BIGINT,
- checksum VARCHAR(64),
- create_by VARCHAR(36),
- create_by_name VARCHAR(100),
- create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
- update_by VARCHAR(36),
- update_by_name VARCHAR(100),
- update_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
- );
- CREATE INDEX IF NOT EXISTS idx_text_storage_document_id ON text_storage(document_id);
- CREATE UNIQUE INDEX IF NOT EXISTS idx_text_storage_document_unique ON text_storage(document_id);
- -- 显示创建结果
- SELECT 'text_storage 表创建成功,字段与 SimpleModel 兼容' AS result;
|