create_tables.sql 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. -- inf 开头的 DB
  2. CREATE TABLE IF NOT EXISTS "inf_file" (
  3. "id" varchar(188) NOT NULL,
  4. "type" varchar(63) DEFAULT NULL,
  5. "content" blob NOT NULL,
  6. "creator" varchar(64) DEFAULT '',
  7. "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  8. "updater" varchar(64) DEFAULT '',
  9. "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  10. "deleted" bit NOT NULL DEFAULT FALSE,
  11. "tenant_id" bigint not null default '0',
  12. PRIMARY KEY ("id")
  13. ) COMMENT '文件表';
  14. -- sys 开头的 DB
  15. CREATE TABLE IF NOT EXISTS `sys_user_session` (
  16. `id` varchar(32) NOT NULL,
  17. `user_id` bigint DEFAULT NULL,
  18. "user_type" tinyint NOT NULL,
  19. `username` varchar(50) NOT NULL DEFAULT '',
  20. `user_ip` varchar(50) DEFAULT NULL,
  21. `user_agent` varchar(512) DEFAULT NULL,
  22. `session_timeout` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  23. "creator" varchar(64) DEFAULT '',
  24. "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  25. `updater` varchar(64) DEFAULT '' ,
  26. "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  27. "deleted" bit NOT NULL DEFAULT FALSE,
  28. "tenant_id" bigint not null default '0',
  29. PRIMARY KEY (`id`)
  30. ) COMMENT '用户在线 Session';
  31. CREATE TABLE IF NOT EXISTS "sys_dict_data" (
  32. "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
  33. "sort" int NOT NULL DEFAULT '0',
  34. "label" varchar(100) NOT NULL DEFAULT '',
  35. "value" varchar(100) NOT NULL DEFAULT '',
  36. "dict_type" varchar(100) NOT NULL DEFAULT '',
  37. "status" tinyint NOT NULL DEFAULT '0',
  38. "remark" varchar(500) DEFAULT NULL,
  39. "creator" varchar(64) DEFAULT '',
  40. "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  41. "updater" varchar(64) DEFAULT '',
  42. "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  43. "deleted" bit NOT NULL DEFAULT FALSE,
  44. PRIMARY KEY ("id")
  45. ) COMMENT '字典数据表';
  46. CREATE TABLE IF NOT EXISTS "inf_api_access_log" (
  47. "id" bigint not null GENERATED BY DEFAULT AS IDENTITY,
  48. "trace_id" varchar(64) not null default '',
  49. "user_id" bigint not null default '0',
  50. "user_type" tinyint not null default '0',
  51. "application_name" varchar(50) not null,
  52. "request_method" varchar(16) not null default '',
  53. "request_url" varchar(255) not null default '',
  54. "request_params" varchar(8000) not null default '',
  55. "user_ip" varchar(50) not null,
  56. "user_agent" varchar(512) not null,
  57. "begin_time" timestamp not null,
  58. "end_time" timestamp not null,
  59. "duration" integer not null,
  60. "result_code" integer not null default '0',
  61. "result_msg" varchar(512) default '',
  62. "creator" varchar(64) default '',
  63. "create_time" timestamp not null default current_timestamp,
  64. "updater" varchar(64) default '',
  65. "update_time" timestamp not null default current_timestamp,
  66. "deleted" bit not null default false,
  67. "tenant_id" bigint not null default '0',
  68. primary key ("id")
  69. ) COMMENT 'API 访问日志表';
  70. CREATE TABLE IF NOT EXISTS "inf_api_error_log" (
  71. "id" integer not null GENERATED BY DEFAULT AS IDENTITY,
  72. "trace_id" varchar(64) not null,
  73. "user_id" bigint not null default '0',
  74. "user_type" tinyint not null default '0',
  75. "application_name" varchar(50) not null,
  76. "request_method" varchar(16) not null,
  77. "request_url" varchar(255) not null,
  78. "request_params" varchar(8000) not null,
  79. "user_ip" varchar(50) not null,
  80. "user_agent" varchar(512) not null,
  81. "exception_time" timestamp not null,
  82. "exception_name" varchar(128) not null default '',
  83. "exception_message" clob not null,
  84. "exception_root_cause_message" clob not null,
  85. "exception_stack_trace" clob not null,
  86. "exception_class_name" varchar(512) not null,
  87. "exception_file_name" varchar(512) not null,
  88. "exception_method_name" varchar(512) not null,
  89. "exception_line_number" integer not null,
  90. "process_status" tinyint not null,
  91. "process_time" timestamp default null,
  92. "process_user_id" bigint default '0',
  93. "creator" varchar(64) default '',
  94. "create_time" timestamp not null default current_timestamp,
  95. "updater" varchar(64) default '',
  96. "update_time" timestamp not null default current_timestamp,
  97. "deleted" bit not null default false,
  98. "tenant_id" bigint not null default '0',
  99. primary key ("id")
  100. ) COMMENT '系统异常日志';
  101. CREATE TABLE IF NOT EXISTS "sys_sms_template" (
  102. "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
  103. "type" tinyint NOT NULL,
  104. "status" tinyint NOT NULL,
  105. "code" varchar(63) NOT NULL,
  106. "name" varchar(63) NOT NULL,
  107. "content" varchar(255) NOT NULL,
  108. "params" varchar(255) NOT NULL,
  109. "remark" varchar(255) DEFAULT NULL,
  110. "api_template_id" varchar(63) NOT NULL,
  111. "channel_id" bigint NOT NULL,
  112. "channel_code" varchar(63) NOT NULL,
  113. "creator" varchar(64) DEFAULT '',
  114. "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  115. "updater" varchar(64) DEFAULT '',
  116. "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  117. "deleted" bit NOT NULL DEFAULT FALSE,
  118. PRIMARY KEY ("id")
  119. ) COMMENT '短信模板';
  120. CREATE TABLE IF NOT EXISTS "sys_sms_log" (
  121. "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
  122. "channel_id" bigint NOT NULL,
  123. "channel_code" varchar(63) NOT NULL,
  124. "template_id" bigint NOT NULL,
  125. "template_code" varchar(63) NOT NULL,
  126. "template_type" tinyint NOT NULL,
  127. "template_content" varchar(255) NOT NULL,
  128. "template_params" varchar(255) NOT NULL,
  129. "api_template_id" varchar(63) NOT NULL,
  130. "mobile" varchar(11) NOT NULL,
  131. "user_id" bigint DEFAULT '0',
  132. "user_type" tinyint DEFAULT '0',
  133. "send_status" tinyint NOT NULL DEFAULT '0',
  134. "send_time" timestamp DEFAULT NULL,
  135. "send_code" int DEFAULT NULL,
  136. "send_msg" varchar(255) DEFAULT NULL,
  137. "api_send_code" varchar(63) DEFAULT NULL,
  138. "api_send_msg" varchar(255) DEFAULT NULL,
  139. "api_request_id" varchar(255) DEFAULT NULL,
  140. "api_serial_no" varchar(255) DEFAULT NULL,
  141. "receive_status" tinyint NOT NULL DEFAULT '0',
  142. "receive_time" timestamp DEFAULT NULL,
  143. "api_receive_code" varchar(63) DEFAULT NULL,
  144. "api_receive_msg" varchar(255) DEFAULT NULL,
  145. "creator" varchar(64) DEFAULT '',
  146. "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  147. "updater" varchar(64) DEFAULT '',
  148. "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  149. "deleted" bit NOT NULL DEFAULT FALSE,
  150. "tenant_id" bigint not null default '0',
  151. PRIMARY KEY ("id")
  152. ) COMMENT '短信日志';
  153. CREATE TABLE IF NOT EXISTS `sys_login_log` (
  154. `id` bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY,
  155. `log_type` bigint(4) NOT NULL,
  156. "user_id" bigint not null default '0',
  157. "user_type" tinyint NOT NULL,
  158. `trace_id` varchar(64) NOT NULL DEFAULT '',
  159. `username` varchar(50) NOT NULL DEFAULT '',
  160. `result` tinyint(4) NOT NULL,
  161. `user_ip` varchar(50) NOT NULL,
  162. `user_agent` varchar(512) NOT NULL,
  163. `creator` varchar(64) DEFAULT '',
  164. `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  165. `updater` varchar(64) DEFAULT '',
  166. `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  167. `deleted` bit(1) NOT NULL DEFAULT '0',
  168. "tenant_id" bigint not null default '0',
  169. PRIMARY KEY (`id`)
  170. ) COMMENT ='系统访问记录';
  171. CREATE TABLE IF NOT EXISTS "sys_social_user" (
  172. "id" number NOT NULL GENERATED BY DEFAULT AS IDENTITY,
  173. "user_id" bigint NOT NULL,
  174. "user_type" tinyint NOT NULL DEFAULT '0',
  175. "type" tinyint NOT NULL,
  176. "openid" varchar(32) NOT NULL,
  177. "token" varchar(256) DEFAULT NULL,
  178. "union_id" varchar(32) NOT NULL,
  179. "raw_token_info" varchar(1024) NOT NULL,
  180. "nickname" varchar(32) NOT NULL,
  181. "avatar" varchar(255) DEFAULT NULL,
  182. "raw_user_info" varchar(1024) NOT NULL,
  183. "creator" varchar(64) DEFAULT '',
  184. "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  185. "updater" varchar(64) DEFAULT '',
  186. "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  187. "deleted" bit NOT NULL DEFAULT FALSE,
  188. PRIMARY KEY ("id")
  189. ) COMMENT '社交用户';