create_tables.sql 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. CREATE TABLE IF NOT EXISTS "infra_config" (
  2. "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY,
  3. "group" varchar(50) NOT NULL,
  4. "type" tinyint NOT NULL,
  5. "name" varchar(100) NOT NULL DEFAULT '',
  6. "key" varchar(100) NOT NULL DEFAULT '',
  7. "value" varchar(500) NOT NULL DEFAULT '',
  8. "sensitive" bit NOT NULL,
  9. "remark" varchar(500) DEFAULT NULL,
  10. "creator" varchar(64) DEFAULT '',
  11. "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  12. "updater" varchar(64) DEFAULT '',
  13. "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  14. "deleted" bit NOT NULL DEFAULT FALSE,
  15. PRIMARY KEY ("id")
  16. ) COMMENT '参数配置表';
  17. CREATE TABLE IF NOT EXISTS "infra_file" (
  18. "id" varchar(188) NOT NULL,
  19. "type" varchar(63) DEFAULT NULL,
  20. "content" blob NOT NULL,
  21. "creator" varchar(64) DEFAULT '',
  22. "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  23. "updater" varchar(64) DEFAULT '',
  24. "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  25. "deleted" bit NOT NULL DEFAULT FALSE,
  26. "tenant_id" bigint not null default '0',
  27. PRIMARY KEY ("id")
  28. ) COMMENT '文件表';
  29. CREATE TABLE IF NOT EXISTS "infra_job" (
  30. "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '任务编号',
  31. "name" varchar(32) NOT NULL COMMENT '任务名称',
  32. "status" tinyint(4) NOT NULL COMMENT '任务状态',
  33. "handler_name" varchar(64) NOT NULL COMMENT '处理器的名字',
  34. "handler_param" varchar(255) DEFAULT NULL COMMENT '处理器的参数',
  35. "cron_expression" varchar(32) NOT NULL COMMENT 'CRON 表达式',
  36. "retry_count" int(11) NOT NULL DEFAULT '0' COMMENT '重试次数',
  37. "retry_interval" int(11) NOT NULL DEFAULT '0' COMMENT '重试间隔',
  38. "monitor_timeout" int(11) NOT NULL DEFAULT '0' COMMENT '监控超时时间',
  39. "creator" varchar(64) DEFAULT '' COMMENT '创建者',
  40. "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  41. "updater" varchar(64) DEFAULT '' COMMENT '更新者',
  42. "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  43. "deleted" bit NOT NULL DEFAULT FALSE COMMENT '是否删除',
  44. PRIMARY KEY ("id")
  45. ) COMMENT='定时任务表';
  46. CREATE TABLE IF NOT EXISTS "infra_job_log" (
  47. "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '日志编号',
  48. "job_id" bigint(20) NOT NULL COMMENT '任务编号',
  49. "handler_name" varchar(64) NOT NULL COMMENT '处理器的名字',
  50. "handler_param" varchar(255) DEFAULT NULL COMMENT '处理器的参数',
  51. "execute_index" tinyint(4) NOT NULL DEFAULT '1' COMMENT '第几次执行',
  52. "begin_time" datetime NOT NULL COMMENT '开始执行时间',
  53. "end_time" datetime DEFAULT NULL COMMENT '结束执行时间',
  54. "duration" int(11) DEFAULT NULL COMMENT '执行时长',
  55. "status" tinyint(4) NOT NULL COMMENT '任务状态',
  56. "result" varchar(4000) DEFAULT '' COMMENT '结果数据',
  57. "creator" varchar(64) DEFAULT '' COMMENT '创建者',
  58. "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  59. "updater" varchar(64) DEFAULT '' COMMENT '更新者',
  60. "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  61. "deleted" bit(1) NOT NULL DEFAULT FALSE COMMENT '是否删除',
  62. PRIMARY KEY ("id")
  63. )COMMENT='定时任务日志表';
  64. CREATE TABLE IF NOT EXISTS "inf_file" (
  65. "id" varchar(188) NOT NULL,
  66. "type" varchar(63) DEFAULT NULL,
  67. "content" blob NOT NULL,
  68. "creator" varchar(64) DEFAULT '',
  69. "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  70. "updater" varchar(64) DEFAULT '',
  71. "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  72. "deleted" bit NOT NULL DEFAULT FALSE,
  73. "tenant_id" bigint not null default '0',
  74. PRIMARY KEY ("id")
  75. ) COMMENT '文件表';
  76. CREATE TABLE IF NOT EXISTS "infra_api_access_log" (
  77. "id" bigint not null GENERATED BY DEFAULT AS IDENTITY,
  78. "trace_id" varchar(64) not null default '',
  79. "user_id" bigint not null default '0',
  80. "user_type" tinyint not null default '0',
  81. "application_name" varchar(50) not null,
  82. "request_method" varchar(16) not null default '',
  83. "request_url" varchar(255) not null default '',
  84. "request_params" varchar(8000) not null default '',
  85. "user_ip" varchar(50) not null,
  86. "user_agent" varchar(512) not null,
  87. "begin_time" timestamp not null,
  88. "end_time" timestamp not null,
  89. "duration" integer not null,
  90. "result_code" integer not null default '0',
  91. "result_msg" varchar(512) default '',
  92. "creator" varchar(64) default '',
  93. "create_time" timestamp not null default current_timestamp,
  94. "updater" varchar(64) default '',
  95. "update_time" timestamp not null default current_timestamp,
  96. "deleted" bit not null default false,
  97. "tenant_id" bigint not null default '0',
  98. primary key ("id")
  99. ) COMMENT 'API 访问日志表';
  100. CREATE TABLE IF NOT EXISTS "infra_api_error_log" (
  101. "id" bigint not null GENERATED BY DEFAULT AS IDENTITY,
  102. "trace_id" varchar(64) not null,
  103. "user_id" bigint not null default '0',
  104. "user_type" tinyint not null default '0',
  105. "application_name" varchar(50) not null,
  106. "request_method" varchar(16) not null,
  107. "request_url" varchar(255) not null,
  108. "request_params" varchar(8000) not null,
  109. "user_ip" varchar(50) not null,
  110. "user_agent" varchar(512) not null,
  111. "exception_time" timestamp not null,
  112. "exception_name" varchar(128) not null default '',
  113. "exception_message" clob not null,
  114. "exception_root_cause_message" clob not null,
  115. "exception_stack_trace" clob not null,
  116. "exception_class_name" varchar(512) not null,
  117. "exception_file_name" varchar(512) not null,
  118. "exception_method_name" varchar(512) not null,
  119. "exception_line_number" integer not null,
  120. "process_status" tinyint not null,
  121. "process_time" timestamp default null,
  122. "process_user_id" bigint default '0',
  123. "creator" varchar(64) default '',
  124. "create_time" timestamp not null default current_timestamp,
  125. "updater" varchar(64) default '',
  126. "update_time" timestamp not null default current_timestamp,
  127. "deleted" bit not null default false,
  128. "tenant_id" bigint not null default '0',
  129. primary key ("id")
  130. ) COMMENT '系统异常日志';