-- 达梦数据库 OCR日志表建表语句
-- 用于记录OCR识别操作的日志信息

CREATE TABLE "t_ocr_log" (
  "id" INTEGER IDENTITY(1,1) NOT NULL,
  "table_name" VARCHAR(100) DEFAULT NULL,
  "file_name" VARCHAR(255) DEFAULT NULL,
  "status_type" VARCHAR(50) DEFAULT NULL,
  "failure_reason" CLOB DEFAULT NULL,
  "create_time" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  "update_time" TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY ("id")
);

-- 创建索引
CREATE INDEX "idx_ocr_log_table_name" ON "t_ocr_log"("table_name");
CREATE INDEX "idx_ocr_log_file_name" ON "t_ocr_log"("file_name");
CREATE INDEX "idx_ocr_log_status_type" ON "t_ocr_log"("status_type");
CREATE INDEX "idx_ocr_log_create_time" ON "t_ocr_log"("create_time");

-- 添加表注释
COMMENT ON TABLE "t_ocr_log" IS 'OCR识别日志表';
COMMENT ON COLUMN "t_ocr_log"."id" IS '主键ID';
COMMENT ON COLUMN "t_ocr_log"."table_name" IS '表名';
COMMENT ON COLUMN "t_ocr_log"."file_name" IS '文件名';
COMMENT ON COLUMN "t_ocr_log"."status_type" IS '转换状态';
COMMENT ON COLUMN "t_ocr_log"."failure_reason" IS '失败原因';
COMMENT ON COLUMN "t_ocr_log"."create_time" IS '创建时间';
COMMENT ON COLUMN "t_ocr_log"."update_time" IS '更新时间';