DROP TABLE IF EXISTS cvbp_db_version_ctl;
CREATE TABLE cvbp_db_version_ctl(
    id SERIAL NOT NULL,
    business_space VARCHAR(50) NOT NULL,
    major_version int4 NOT NULL,
    minor_version int4 NOT NULL,
    patch_version int4 NOT NULL,
    extend_version int4 NOT NULL DEFAULT  0,
    version VARCHAR(50) NOT NULL,
    custom_name VARCHAR(50) NOT NULL DEFAULT  'none',
    version_type VARCHAR(10) NOT NULL,
    script_file_name VARCHAR(200) NOT NULL DEFAULT  'none',
    script_digest_hex VARCHAR(200) NOT NULL DEFAULT  'none',
    success int2 NOT NULL,
    execution_time int4 NOT NULL,
    install_time VARCHAR(19) NOT NULL,
    install_user VARCHAR(100) NOT NULL,
    PRIMARY KEY (id)
);

COMMENT ON TABLE cvbp_db_version_ctl IS '数据库版本控制表';
COMMENT ON COLUMN cvbp_db_version_ctl.id IS '数据库版本ID';
COMMENT ON COLUMN cvbp_db_version_ctl.business_space IS '业务空间';
COMMENT ON COLUMN cvbp_db_version_ctl.major_version IS '主版本号';
COMMENT ON COLUMN cvbp_db_version_ctl.minor_version IS '次版本号';
COMMENT ON COLUMN cvbp_db_version_ctl.patch_version IS '补丁版本号';
COMMENT ON COLUMN cvbp_db_version_ctl.extend_version IS '扩展版本号';
COMMENT ON COLUMN cvbp_db_version_ctl.version IS '版本号,V[major].[minor].[patch].[extend_version]';
COMMENT ON COLUMN cvbp_db_version_ctl.custom_name IS '脚本自定义名称';
COMMENT ON COLUMN cvbp_db_version_ctl.version_type IS '版本类型:SQL/BaseLine';
COMMENT ON COLUMN cvbp_db_version_ctl.script_file_name IS '脚本文件名';
COMMENT ON COLUMN cvbp_db_version_ctl.script_digest_hex IS '脚本内容摘要(16进制)';
COMMENT ON COLUMN cvbp_db_version_ctl.success IS '是否执行成功';
COMMENT ON COLUMN cvbp_db_version_ctl.execution_time IS '脚本安装耗时';
COMMENT ON COLUMN cvbp_db_version_ctl.install_time IS '脚本安装时间,格式:[yyyy-MM-dd HH:mm:ss]';
COMMENT ON COLUMN cvbp_db_version_ctl.install_user IS '脚本安装用户';
