create_tables.sql 8.2 KB
Newer Older
1 2

CREATE TABLE IF NOT EXISTS "infra_config" (
3
    "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '编号',
4 5
    "category" varchar(50) NOT NULL,
    "type" tinyint NOT NULL,
6
    "name" varchar(100) NOT NULL DEFAULT '' COMMENT '名字',
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
    "config_key" varchar(100) NOT NULL DEFAULT '',
    "value" varchar(500) NOT NULL DEFAULT '',
    "visible" bit NOT NULL,
    "remark" varchar(500) DEFAULT NULL,
    "creator" varchar(64) DEFAULT '',
    "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updater" varchar(64) DEFAULT '',
    "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "deleted" bit NOT NULL DEFAULT FALSE,
    PRIMARY KEY ("id")
) COMMENT '参数配置表';

CREATE TABLE IF NOT EXISTS "infra_file_config" (
    "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
    "name" varchar(63) NOT NULL,
    "storage" tinyint NOT NULL,
    "remark" varchar(255),
    "master" bit(1) NOT NULL,
    "config" varchar(4096) NOT NULL,
    "creator" varchar(64) DEFAULT '',
    "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updater" varchar(64) DEFAULT '',
    "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    "deleted" bit NOT NULL DEFAULT FALSE,
    PRIMARY KEY ("id")
) COMMENT '文件配置表';

CREATE TABLE IF NOT EXISTS "infra_file" (
    "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
    "config_id" bigint NOT NULL,
37
    "name" varchar(256),
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
    "path" varchar(512),
    "url" varchar(1024),
    "type" varchar(63) DEFAULT NULL,
    "size" bigint NOT NULL,
    "creator" varchar(64) DEFAULT '',
    "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updater" varchar(64) DEFAULT '',
    "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "deleted" bit NOT NULL DEFAULT FALSE,
    "tenant_id" bigint not null default  '0',
    PRIMARY KEY ("id")
) COMMENT '文件表';

CREATE TABLE IF NOT EXISTS "infra_job" (
    "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '任务编号',
    "name" varchar(32) NOT NULL COMMENT '任务名称',
    "status" tinyint(4) NOT NULL COMMENT '任务状态',
    "handler_name" varchar(64) NOT NULL COMMENT '处理器的名字',
    "handler_param" varchar(255) DEFAULT NULL COMMENT '处理器的参数',
    "cron_expression" varchar(32) NOT NULL COMMENT 'CRON 表达式',
    "retry_count" int(11) NOT NULL DEFAULT '0' COMMENT '重试次数',
    "retry_interval" int(11) NOT NULL DEFAULT '0' COMMENT '重试间隔',
    "monitor_timeout" int(11) NOT NULL DEFAULT '0' COMMENT '监控超时时间',
    "creator" varchar(64) DEFAULT '' COMMENT '创建者',
    "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    "updater" varchar(64) DEFAULT '' COMMENT '更新者',
    "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    "deleted" bit NOT NULL DEFAULT FALSE COMMENT '是否删除',
    PRIMARY KEY ("id")
) COMMENT='定时任务表';

CREATE TABLE IF NOT EXISTS "infra_job_log" (
    "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '日志编号',
    "job_id" bigint(20) NOT NULL COMMENT '任务编号',
    "handler_name" varchar(64) NOT NULL COMMENT '处理器的名字',
    "handler_param" varchar(255) DEFAULT NULL COMMENT '处理器的参数',
    "execute_index" tinyint(4) NOT NULL DEFAULT '1' COMMENT '第几次执行',
    "begin_time" datetime NOT NULL COMMENT '开始执行时间',
    "end_time" datetime DEFAULT NULL COMMENT '结束执行时间',
    "duration" int(11) DEFAULT NULL COMMENT '执行时长',
    "status" tinyint(4) NOT NULL COMMENT '任务状态',
    "result" varchar(4000) DEFAULT '' COMMENT '结果数据',
    "creator" varchar(64) DEFAULT '' COMMENT '创建者',
    "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    "updater" varchar(64) DEFAULT '' COMMENT '更新者',
    "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    "deleted" bit(1) NOT NULL DEFAULT FALSE COMMENT '是否删除',
    PRIMARY KEY ("id")
)COMMENT='定时任务日志表';

CREATE TABLE IF NOT EXISTS "inf_file" (
    "id" varchar(188) NOT NULL,
    "type" varchar(63) DEFAULT NULL,
    "content" blob NOT NULL,
    "creator" varchar(64) DEFAULT '',
    "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updater" varchar(64) DEFAULT '',
    "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "deleted" bit NOT NULL DEFAULT FALSE,
    "tenant_id" bigint not null default  '0',
    PRIMARY KEY ("id")
    ) COMMENT '文件表';

CREATE TABLE IF NOT EXISTS "infra_api_access_log" (
    "id" bigint not null GENERATED BY DEFAULT AS IDENTITY,
    "trace_id" varchar(64) not null default '',
    "user_id" bigint not null default '0',
    "user_type" tinyint not null default '0',
    "application_name" varchar(50) not null,
    "request_method" varchar(16) not null default '',
    "request_url" varchar(255) not null default '',
    "request_params" varchar(8000) not null default '',
    "user_ip" varchar(50) not null,
    "user_agent" varchar(512) not null,
    "begin_time" timestamp not null,
    "end_time" timestamp not null,
    "duration" integer not null,
    "result_code" integer not null default '0',
    "result_msg" varchar(512) default '',
    "creator" varchar(64) default '',
    "create_time" timestamp not null default current_timestamp,
    "updater" varchar(64) default '',
    "update_time" timestamp not null default current_timestamp,
    "deleted" bit not null default false,
    "tenant_id" bigint not null default  '0',
    primary key ("id")
    ) COMMENT 'API 访问日志表';

CREATE TABLE IF NOT EXISTS "infra_api_error_log" (
    "id" bigint not null GENERATED BY DEFAULT AS IDENTITY,
    "trace_id" varchar(64) not null,
    "user_id" bigint not null default '0',
    "user_type" tinyint not null default '0',
    "application_name" varchar(50) not null,
    "request_method" varchar(16) not null,
    "request_url" varchar(255) not null,
    "request_params" varchar(8000) not null,
    "user_ip" varchar(50) not null,
    "user_agent" varchar(512) not null,
    "exception_time" timestamp not null,
    "exception_name" varchar(128) not null default '',
    "exception_message" clob not null,
    "exception_root_cause_message" clob not null,
    "exception_stack_trace" clob not null,
    "exception_class_name" varchar(512) not null,
    "exception_file_name" varchar(512) not null,
    "exception_method_name" varchar(512) not null,
    "exception_line_number" integer not null,
    "process_status" tinyint not null,
    "process_time" timestamp default null,
    "process_user_id" bigint default '0',
    "creator" varchar(64) default '',
    "create_time" timestamp not null default current_timestamp,
    "updater" varchar(64) default '',
    "update_time" timestamp not null default current_timestamp,
    "deleted" bit not null default false,
    "tenant_id" bigint not null default  '0',
    primary key ("id")
) COMMENT '系统异常日志';

CREATE TABLE IF NOT EXISTS "infra_test_demo" (
    "id"          bigint       NOT NULL GENERATED BY DEFAULT AS IDENTITY,
    "name"        varchar(100) NOT NULL,
    "status"      tinyint      NOT NULL,
    "type"        tinyint      NOT NULL,
    "category"    tinyint      NOT NULL,
    "remark"      varchar(500),
    "creator"     varchar(64)           DEFAULT '''',
    "create_time" datetime     NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updater"     varchar(64)           DEFAULT '''',
    "update_time" datetime     NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    "deleted"     bit          NOT NULL DEFAULT FALSE,
    PRIMARY KEY ("id")
) COMMENT '字典类型表';

CREATE TABLE IF NOT EXISTS "infra_data_source_config" (
    "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
    "name" varchar(100) NOT NULL,
    "url" varchar(1024) NOT NULL,
    "username" varchar(255) NOT NULL,
    "password" varchar(255) NOT NULL,
    "creator" varchar(64) DEFAULT '',
    "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updater" varchar(64) DEFAULT '',
    "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    "deleted" bit NOT NULL DEFAULT FALSE,
    PRIMARY KEY ("id")
) COMMENT '数据源配置表';