-- 培训数据快照表
CREATE TABLE t_training_snapshot (
  ID NUMBER(20) NOT NULL,
  SNAPSHOT_NAME VARCHAR2(200) NOT NULL,
  DESCRIPTION VARCHAR2(500),
  SNAPSHOT_YEAR VARCHAR2(4) NOT NULL,
  TRAINING_TYPE VARCHAR2(50),
  SNAPSHOT_DATA CLOB,
  QUERY_PARAMS CLOB,
  CREATER_CODE VARCHAR2(64),
  CREATEDATE DATE,
  UPDATER_CODE VARCHAR2(64),
  UPDATEDATE DATE,
  DEL_FLAG NUMBER(1) DEFAULT 0,
  CONSTRAINT pk_training_snapshot PRIMARY KEY (ID)
);

-- 添加注释
COMMENT ON TABLE t_training_snapshot IS '培训数据快照表';
COMMENT ON COLUMN t_training_snapshot.ID IS '快照ID';
COMMENT ON COLUMN t_training_snapshot.SNAPSHOT_NAME IS '快照名称';
COMMENT ON COLUMN t_training_snapshot.DESCRIPTION IS '快照描述';
COMMENT ON COLUMN t_training_snapshot.SNAPSHOT_YEAR IS '快照年份';
COMMENT ON COLUMN t_training_snapshot.TRAINING_TYPE IS '培训类型';
COMMENT ON COLUMN t_training_snapshot.SNAPSHOT_DATA IS '快照数据JSON';
COMMENT ON COLUMN t_training_snapshot.QUERY_PARAMS IS '查询参数JSON';
COMMENT ON COLUMN t_training_snapshot.CREATER_CODE IS '创建人';
COMMENT ON COLUMN t_training_snapshot.CREATEDATE IS '创建时间';
COMMENT ON COLUMN t_training_snapshot.UPDATER_CODE IS '修改人';
COMMENT ON COLUMN t_training_snapshot.UPDATEDATE IS '修改时间';
COMMENT ON COLUMN t_training_snapshot.DEL_FLAG IS '删除标志（0代表存在 2代表删除）';

-- 创建序列
CREATE SEQUENCE seq_t_training_snapshot
  START WITH 1
  INCREMENT BY 1
  NOCACHE
  NOCYCLE;

-- 创建索引
CREATE INDEX idx_training_snapshot_year ON t_training_snapshot(SNAPSHOT_YEAR);
CREATE INDEX idx_training_snapshot_type ON t_training_snapshot(TRAINING_TYPE);
CREATE INDEX idx_training_snapshot_create_time ON t_training_snapshot(CREATEDATE);
