|
@@ -12,25 +12,16 @@ CREATE TABLE IF NOT EXISTS text_storage (
|
|
|
file_path VARCHAR(500) NOT NULL,
|
|
file_path VARCHAR(500) NOT NULL,
|
|
|
file_size BIGINT,
|
|
file_size BIGINT,
|
|
|
checksum VARCHAR(64),
|
|
checksum VARCHAR(64),
|
|
|
- created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
|
- updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
|
|
|
|
|
+ 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 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);
|
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_text_storage_document_unique ON text_storage(document_id);
|
|
|
|
|
|
|
|
--- 创建更新时间触发器
|
|
|
|
|
-CREATE OR REPLACE FUNCTION update_text_storage_updated_at()
|
|
|
|
|
-RETURNS TRIGGER AS $$
|
|
|
|
|
-BEGIN
|
|
|
|
|
- NEW.updated_at = CURRENT_TIMESTAMP;
|
|
|
|
|
- RETURN NEW;
|
|
|
|
|
-END;
|
|
|
|
|
-$$ LANGUAGE plpgsql;
|
|
|
|
|
-
|
|
|
|
|
-DROP TRIGGER IF EXISTS update_text_storage_updated_at ON text_storage;
|
|
|
|
|
-CREATE TRIGGER update_text_storage_updated_at BEFORE UPDATE ON text_storage
|
|
|
|
|
- FOR EACH ROW EXECUTE FUNCTION update_text_storage_updated_at();
|
|
|
|
|
-
|
|
|
|
|
-- 显示创建结果
|
|
-- 显示创建结果
|
|
|
-SELECT 'text_storage 表创建成功' AS result;
|
|
|
|
|
|
|
+SELECT 'text_storage 表创建成功,字段与 SimpleModel 兼容' AS result;
|