schema.sql 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. CREATE SCHEMA nacos AUTHORIZATION nacos;
  2. CREATE TABLE config_info (
  3. id bigint NOT NULL generated by default as identity,
  4. data_id varchar(255) NOT NULL,
  5. group_id varchar(128) NOT NULL,
  6. tenant_id varchar(128) default '',
  7. app_name varchar(128),
  8. content CLOB,
  9. md5 varchar(32) DEFAULT NULL,
  10. gmt_create timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
  11. gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
  12. src_user varchar(128) DEFAULT NULL,
  13. src_ip varchar(20) DEFAULT NULL,
  14. c_desc varchar(256) DEFAULT NULL,
  15. c_use varchar(64) DEFAULT NULL,
  16. effect varchar(64) DEFAULT NULL,
  17. type varchar(64) DEFAULT NULL,
  18. c_schema LONG VARCHAR DEFAULT NULL,
  19. constraint configinfo_id_key PRIMARY KEY (id),
  20. constraint uk_configinfo_datagrouptenant UNIQUE (data_id,group_id,tenant_id));
  21. CREATE INDEX configinfo_dataid_key_idx ON config_info(data_id);
  22. CREATE INDEX configinfo_groupid_key_idx ON config_info(group_id);
  23. CREATE INDEX configinfo_dataid_group_key_idx ON config_info(data_id, group_id);
  24. CREATE TABLE his_config_info (
  25. id bigint NOT NULL,
  26. nid bigint NOT NULL generated by default as identity,
  27. data_id varchar(255) NOT NULL,
  28. group_id varchar(128) NOT NULL,
  29. tenant_id varchar(128) default '',
  30. app_name varchar(128),
  31. content CLOB,
  32. md5 varchar(32) DEFAULT NULL,
  33. gmt_create timestamp NOT NULL DEFAULT '2010-05-05 00:00:00.000',
  34. gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00.000',
  35. src_user varchar(128),
  36. src_ip varchar(20) DEFAULT NULL,
  37. op_type char(10) DEFAULT NULL,
  38. constraint hisconfiginfo_nid_key PRIMARY KEY (nid));
  39. CREATE INDEX hisconfiginfo_dataid_key_idx ON his_config_info(data_id);
  40. CREATE INDEX hisconfiginfo_gmt_create_idx ON his_config_info(gmt_create);
  41. CREATE INDEX hisconfiginfo_gmt_modified_idx ON his_config_info(gmt_modified);
  42. CREATE TABLE config_info_beta (
  43. id bigint NOT NULL generated by default as identity,
  44. data_id varchar(255) NOT NULL,
  45. group_id varchar(128) NOT NULL,
  46. tenant_id varchar(128) default '',
  47. app_name varchar(128),
  48. content CLOB,
  49. beta_ips varchar(1024),
  50. md5 varchar(32) DEFAULT NULL,
  51. gmt_create timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
  52. gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
  53. src_user varchar(128),
  54. src_ip varchar(20) DEFAULT NULL,
  55. constraint configinfobeta_id_key PRIMARY KEY (id),
  56. constraint uk_configinfobeta_datagrouptenant UNIQUE (data_id,group_id,tenant_id));
  57. CREATE TABLE config_info_tag (
  58. id bigint NOT NULL generated by default as identity,
  59. data_id varchar(255) NOT NULL,
  60. group_id varchar(128) NOT NULL,
  61. tenant_id varchar(128) default '',
  62. tag_id varchar(128) NOT NULL,
  63. app_name varchar(128),
  64. content CLOB,
  65. md5 varchar(32) DEFAULT NULL,
  66. gmt_create timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
  67. gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
  68. src_user varchar(128),
  69. src_ip varchar(20) DEFAULT NULL,
  70. constraint configinfotag_id_key PRIMARY KEY (id),
  71. constraint uk_configinfotag_datagrouptenanttag UNIQUE (data_id,group_id,tenant_id,tag_id));
  72. CREATE TABLE config_info_aggr (
  73. id bigint NOT NULL generated by default as identity,
  74. data_id varchar(255) NOT NULL,
  75. group_id varchar(128) NOT NULL,
  76. tenant_id varchar(128) default '',
  77. datum_id varchar(255) NOT NULL,
  78. app_name varchar(128),
  79. content CLOB,
  80. gmt_modified timestamp NOT NULL DEFAULT '2010-05-05 00:00:00',
  81. constraint configinfoaggr_id_key PRIMARY KEY (id),
  82. constraint uk_configinfoaggr_datagrouptenantdatum UNIQUE (data_id,group_id,tenant_id,datum_id));
  83. CREATE TABLE app_list (
  84. id bigint NOT NULL generated by default as identity,
  85. app_name varchar(128) NOT NULL,
  86. is_dynamic_collect_disabled smallint DEFAULT 0,
  87. last_sub_info_collected_time timestamp DEFAULT '1970-01-01 08:00:00.0',
  88. sub_info_lock_owner varchar(128),
  89. sub_info_lock_time timestamp DEFAULT '1970-01-01 08:00:00.0',
  90. constraint applist_id_key PRIMARY KEY (id),
  91. constraint uk_appname UNIQUE (app_name));
  92. CREATE TABLE app_configdata_relation_subs (
  93. id bigint NOT NULL generated by default as identity,
  94. app_name varchar(128) NOT NULL,
  95. data_id varchar(255) NOT NULL,
  96. group_id varchar(128) NOT NULL,
  97. gmt_modified timestamp DEFAULT '2010-05-05 00:00:00',
  98. constraint configdatarelationsubs_id_key PRIMARY KEY (id),
  99. constraint uk_app_sub_config_datagroup UNIQUE (app_name, data_id, group_id));
  100. CREATE TABLE app_configdata_relation_pubs (
  101. id bigint NOT NULL generated by default as identity,
  102. app_name varchar(128) NOT NULL,
  103. data_id varchar(255) NOT NULL,
  104. group_id varchar(128) NOT NULL,
  105. gmt_modified timestamp DEFAULT '2010-05-05 00:00:00',
  106. constraint configdatarelationpubs_id_key PRIMARY KEY (id),
  107. constraint uk_app_pub_config_datagroup UNIQUE (app_name, data_id, group_id));
  108. CREATE TABLE config_tags_relation (
  109. id bigint NOT NULL,
  110. tag_name varchar(128) NOT NULL,
  111. tag_type varchar(64) DEFAULT NULL,
  112. data_id varchar(255) NOT NULL,
  113. group_id varchar(128) NOT NULL,
  114. tenant_id varchar(128) DEFAULT '',
  115. nid bigint NOT NULL generated by default as identity,
  116. constraint config_tags_id_key PRIMARY KEY (nid),
  117. constraint uk_configtagrelation_configidtag UNIQUE (id, tag_name, tag_type));
  118. CREATE INDEX config_tags_tenant_id_idx ON config_tags_relation(tenant_id);
  119. CREATE TABLE group_capacity (
  120. id bigint NOT NULL generated by default as identity,
  121. group_id varchar(128) DEFAULT '',
  122. quota int DEFAULT 0,
  123. usage int DEFAULT 0,
  124. max_size int DEFAULT 0,
  125. max_aggr_count int DEFAULT 0,
  126. max_aggr_size int DEFAULT 0,
  127. max_history_count int DEFAULT 0,
  128. gmt_create timestamp DEFAULT '2010-05-05 00:00:00',
  129. gmt_modified timestamp DEFAULT '2010-05-05 00:00:00',
  130. constraint group_capacity_id_key PRIMARY KEY (id),
  131. constraint uk_group_id UNIQUE (group_id));
  132. CREATE TABLE tenant_capacity (
  133. id bigint NOT NULL generated by default as identity,
  134. tenant_id varchar(128) DEFAULT '',
  135. quota int DEFAULT 0,
  136. usage int DEFAULT 0,
  137. max_size int DEFAULT 0,
  138. max_aggr_count int DEFAULT 0,
  139. max_aggr_size int DEFAULT 0,
  140. max_history_count int DEFAULT 0,
  141. gmt_create timestamp DEFAULT '2010-05-05 00:00:00',
  142. gmt_modified timestamp DEFAULT '2010-05-05 00:00:00',
  143. constraint tenant_capacity_id_key PRIMARY KEY (id),
  144. constraint uk_tenant_id UNIQUE (tenant_id));
  145. CREATE TABLE tenant_info (
  146. id bigint NOT NULL generated by default as identity,
  147. kp varchar(128) NOT NULL,
  148. tenant_id varchar(128) DEFAULT '',
  149. tenant_name varchar(128) DEFAULT '',
  150. tenant_desc varchar(256) DEFAULT NULL,
  151. create_source varchar(32) DEFAULT NULL,
  152. gmt_create bigint NOT NULL,
  153. gmt_modified bigint NOT NULL,
  154. constraint tenant_info_id_key PRIMARY KEY (id),
  155. constraint uk_tenant_info_kptenantid UNIQUE (kp,tenant_id));
  156. CREATE INDEX tenant_info_tenant_id_idx ON tenant_info(tenant_id);
  157. CREATE TABLE users (
  158. username varchar(50) NOT NULL PRIMARY KEY,
  159. password varchar(500) NOT NULL,
  160. enabled boolean NOT NULL
  161. );
  162. CREATE TABLE roles (
  163. username varchar(50) NOT NULL,
  164. role varchar(50) NOT NULL
  165. );
  166. INSERT INTO users (username, password, enabled) VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', TRUE);
  167. INSERT INTO roles (username, role) VALUES ('nacos', 'ROLE_ADMIN');