ソースを参照

fix: 修复 text_storage 表字段名以匹配 SimpleModel

使用 create_time/update_time 而不是 created_at/updated_at,
添加 create_by/update_by 等审计字段以完全兼容 SimpleModel 基类
何文松 1 ヶ月 前
コミット
7f82ff1d12
1 ファイル変更7 行追加16 行削除
  1. 7 16
      backend/sql/text_storage_only.sql

+ 7 - 16
backend/sql/text_storage_only.sql

@@ -12,25 +12,16 @@ CREATE TABLE IF NOT EXISTS text_storage (
     file_path VARCHAR(500) NOT NULL,
     file_size BIGINT,
     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 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;