赞
踩
官网源码
https://github.com/alibaba/nacos/releases/tag/2.3.1
作者修改后的源码
点击前往
-- ---------------------------- -- Sequence structure for config_info_aggr_id_seq -- ---------------------------- DROP SEQUENCE IF EXISTS "public"."config_info_aggr_id_seq"; CREATE SEQUENCE "public"."config_info_aggr_id_seq" INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1; -- ---------------------------- -- Sequence structure for config_info_beta_id_seq -- ---------------------------- DROP SEQUENCE IF EXISTS "public"."config_info_beta_id_seq"; CREATE SEQUENCE "public"."config_info_beta_id_seq" INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1; -- ---------------------------- -- Sequence structure for config_info_id_seq -- ---------------------------- DROP SEQUENCE IF EXISTS "public"."config_info_id_seq"; CREATE SEQUENCE "public"."config_info_id_seq" INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1; -- ---------------------------- -- Sequence structure for config_info_tag_id_seq -- ---------------------------- DROP SEQUENCE IF EXISTS "public"."config_info_tag_id_seq"; CREATE SEQUENCE "public"."config_info_tag_id_seq" INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1; -- ---------------------------- -- Sequence structure for config_tags_relation_id_seq -- ---------------------------- DROP SEQUENCE IF EXISTS "public"."config_tags_relation_id_seq"; CREATE SEQUENCE "public"."config_tags_relation_id_seq" INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1; -- ---------------------------- -- Sequence structure for config_tags_relation_nid_seq -- ---------------------------- DROP SEQUENCE IF EXISTS "public"."config_tags_relation_nid_seq"; CREATE SEQUENCE "public"."config_tags_relation_nid_seq" INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1; -- ---------------------------- -- Sequence structure for group_capacity_id_seq -- ---------------------------- DROP SEQUENCE IF EXISTS "public"."group_capacity_id_seq"; CREATE SEQUENCE "public"."group_capacity_id_seq" INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1; -- ---------------------------- -- Sequence structure for his_config_info_nid_seq -- ---------------------------- DROP SEQUENCE IF EXISTS "public"."his_config_info_nid_seq"; CREATE SEQUENCE "public"."his_config_info_nid_seq" INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1; -- ---------------------------- -- Sequence structure for tenant_capacity_id_seq -- ---------------------------- DROP SEQUENCE IF EXISTS "public"."tenant_capacity_id_seq"; CREATE SEQUENCE "public"."tenant_capacity_id_seq" INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1; -- ---------------------------- -- Sequence structure for tenant_info_id_seq -- ---------------------------- DROP SEQUENCE IF EXISTS "public"."tenant_info_id_seq"; CREATE SEQUENCE "public"."tenant_info_id_seq" INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1; -- ---------------------------- -- Table structure for config_info -- ---------------------------- DROP TABLE IF EXISTS "public"."config_info"; CREATE TABLE "public"."config_info" ( "id" int8 NOT NULL DEFAULT nextval('config_info_id_seq'::regclass), "data_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL, "group_id" varchar(255) COLLATE "pg_catalog"."default", "content" text COLLATE "pg_catalog"."default" NOT NULL, "md5" varchar(32) COLLATE "pg_catalog"."default", "gmt_create" timestamp(6) NOT NULL, "gmt_modified" timestamp(6) NOT NULL, "src_user" text COLLATE "pg_catalog"."default", "src_ip" varchar(20) COLLATE "pg_catalog"."default", "app_name" varchar(128) COLLATE "pg_catalog"."default", "tenant_id" varchar(128) COLLATE "pg_catalog"."default", "c_desc" varchar(256) COLLATE "pg_catalog"."default", "c_use" varchar(64) COLLATE "pg_catalog"."default", "effect" varchar(64) COLLATE "pg_catalog"."default", "type" varchar(64) COLLATE "pg_catalog"."default", "c_schema" text COLLATE "pg_catalog"."default", "encrypted_data_key" text COLLATE "pg_catalog"."default" NOT NULL ) ; COMMENT ON COLUMN "public"."config_info"."id" IS 'id'; COMMENT ON COLUMN "public"."config_info"."data_id" IS 'data_id'; COMMENT ON COLUMN "public"."config_info"."content" IS 'content'; COMMENT ON COLUMN "public"."config_info"."md5" IS 'md5'; COMMENT ON COLUMN "public"."config_info"."gmt_create" IS '创建时间'; COMMENT ON COLUMN "public"."config_info"."gmt_modified" IS '修改时间'; COMMENT ON COLUMN "public"."config_info"."src_user" IS 'source user'; COMMENT ON COLUMN "public"."config_info"."src_ip" IS 'source ip'; COMMENT ON COLUMN "public"."config_info"."tenant_id" IS '租户字段'; COMMENT ON COLUMN "public"."config_info"."encrypted_data_key" IS '秘钥'; COMMENT ON TABLE "public"."config_info" IS 'config_info'; -- ---------------------------- -- Table structure for config_info_aggr -- ---------------------------- DROP TABLE IF EXISTS "public"."config_info_aggr"; CREATE TABLE "public"."config_info_aggr" ( "id" int8 NOT NULL DEFAULT nextval('config_info_aggr_id_seq'::regclass), "data_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL, "group_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL, "datum_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL, "content" text COLLATE "pg_catalog"."default" NOT NULL, "gmt_modified" timestamp(6) NOT NULL, "app_name" varchar(128) COLLATE "pg_catalog"."default", "tenant_id" varchar(128) COLLATE "pg_catalog"."default" ) ; COMMENT ON COLUMN "public"."config_info_aggr"."id" IS 'id'; COMMENT ON COLUMN "public"."config_info_aggr"."data_id" IS 'data_id'; COMMENT ON COLUMN "public"."config_info_aggr"."group_id" IS 'group_id'; COMMENT ON COLUMN "public"."config_info_aggr"."datum_id" IS 'datum_id'; COMMENT ON COLUMN "public"."config_info_aggr"."content" IS '内容'; COMMENT ON COLUMN "public"."config_info_aggr"."gmt_modified" IS '修改时间'; COMMENT ON COLUMN "public"."config_info_aggr"."tenant_id" IS '租户字段'; COMMENT ON TABLE "public"."config_info_aggr" IS '增加租户字段'; -- ---------------------------- -- Table structure for config_info_beta -- ---------------------------- DROP TABLE IF EXISTS "public"."config_info_beta"; CREATE TABLE "public"."config_info_beta" ( "id" int8 NOT NULL DEFAULT nextval('config_info_beta_id_seq'::regclass), "data_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL, "group_id" varchar(128) COLLATE "pg_catalog"."default" NOT NULL, "app_name" varchar(128) COLLATE "pg_catalog"."default", "content" text COLLATE "pg_catalog"."default" NOT NULL, "beta_ips" varchar(1024) COLLATE "pg_catalog"."default", "md5" varchar(32) COLLATE "pg_catalog"."default", "gmt_create" timestamp(6) NOT NULL, "gmt_modified" timestamp(6) NOT NULL, "src_user" text COLLATE "pg_catalog"."default", "src_ip" varchar(20) COLLATE "pg_catalog"."default", "tenant_id" varchar(128) COLLATE "pg_catalog"."default", "encrypted_data_key" text COLLATE "pg_catalog"."default" NOT NULL ) ; COMMENT ON COLUMN "public"."config_info_beta"."id" IS 'id'; COMMENT ON COLUMN "public"."config_info_beta"."data_id" IS 'data_id'; COMMENT ON COLUMN "public"."config_info_beta"."group_id" IS 'group_id'; COMMENT ON COLUMN "public"."config_info_beta"."app_name" IS 'app_name'; COMMENT ON COLUMN "public"."config_info_beta"."content" IS 'content'; COMMENT ON COLUMN "public"."config_info_beta"."beta_ips" IS 'betaIps'; COMMENT ON COLUMN "public"."config_info_beta"."md5" IS 'md5'; COMMENT ON COLUMN "public"."config_info_beta"."gmt_create" IS '创建时间'; COMMENT ON COLUMN "public"."config_info_beta"."gmt_modified" IS '修改时间'; COMMENT ON COLUMN "public"."config_info_beta"."src_user" IS 'source user'; COMMENT ON COLUMN "public"."config_info_beta"."src_ip" IS 'source ip'; COMMENT ON COLUMN "public"."config_info_beta"."tenant_id" IS '租户字段'; COMMENT ON COLUMN "public"."config_info_beta"."encrypted_data_key" IS '秘钥'; COMMENT ON TABLE "public"."config_info_beta" IS 'config_info_beta'; -- ---------------------------- -- Table structure for config_info_tag -- ---------------------------- DROP TABLE IF EXISTS "public"."config_info_tag"; CREATE TABLE "public"."config_info_tag" ( "id" int8 NOT NULL DEFAULT nextval('config_info_tag_id_seq'::regclass), "data_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL, "group_id" varchar(128) COLLATE "pg_catalog"."default" NOT NULL, "tenant_id" varchar(128) COLLATE "pg_catalog"."default", "tag_id" varchar(128) COLLATE "pg_catalog"."default" NOT NULL, "app_name" varchar(128) COLLATE "pg_catalog"."default", "content" text COLLATE "pg_catalog"."default" NOT NULL, "md5" varchar(32) COLLATE "pg_catalog"."default", "gmt_create" timestamp(6) NOT NULL, "gmt_modified" timestamp(6) NOT NULL, "src_user" text COLLATE "pg_catalog"."default", "src_ip" varchar(20) COLLATE "pg_catalog"."default" ) ; COMMENT ON COLUMN "public"."config_info_tag"."id" IS 'id'; COMMENT ON COLUMN "public"."config_info_tag"."data_id" IS 'data_id'; COMMENT ON COLUMN "public"."config_info_tag"."group_id" IS 'group_id'; COMMENT ON COLUMN "public"."config_info_tag"."tenant_id" IS 'tenant_id'; COMMENT ON COLUMN "public"."config_info_tag"."tag_id" IS 'tag_id'; COMMENT ON COLUMN "public"."config_info_tag"."app_name" IS 'app_name'; COMMENT ON COLUMN "public"."config_info_tag"."content" IS 'content'; COMMENT ON COLUMN "public"."config_info_tag"."md5" IS 'md5'; COMMENT ON COLUMN "public"."config_info_tag"."gmt_create" IS '创建时间'; COMMENT ON COLUMN "public"."config_info_tag"."gmt_modified" IS '修改时间'; COMMENT ON COLUMN "public"."config_info_tag"."src_user" IS 'source user'; COMMENT ON COLUMN "public"."config_info_tag"."src_ip" IS 'source ip'; COMMENT ON TABLE "public"."config_info_tag" IS 'config_info_tag'; -- ---------------------------- -- Table structure for config_tags_relation -- ---------------------------- DROP TABLE IF EXISTS "public"."config_tags_relation"; CREATE TABLE "public"."config_tags_relation" ( "id" int8 NOT NULL DEFAULT nextval('config_tags_relation_id_seq'::regclass), "tag_name" varchar(128) COLLATE "pg_catalog"."default" NOT NULL, "tag_type" varchar(64) COLLATE "pg_catalog"."default", "data_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL, "group_id" varchar(128) COLLATE "pg_catalog"."default" NOT NULL, "tenant_id" varchar(128) COLLATE "pg_catalog"."default", "nid" int8 NOT NULL DEFAULT nextval('config_tags_relation_nid_seq'::regclass) ) ; COMMENT ON COLUMN "public"."config_tags_relation"."id" IS 'id'; COMMENT ON COLUMN "public"."config_tags_relation"."tag_name" IS 'tag_name'; COMMENT ON COLUMN "public"."config_tags_relation"."tag_type" IS 'tag_type'; COMMENT ON COLUMN "public"."config_tags_relation"."data_id" IS 'data_id'; COMMENT ON COLUMN "public"."config_tags_relation"."group_id" IS 'group_id'; COMMENT ON COLUMN "public"."config_tags_relation"."tenant_id" IS 'tenant_id'; COMMENT ON TABLE "public"."config_tags_relation" IS 'config_tag_relation'; -- ---------------------------- -- Table structure for group_capacity -- ---------------------------- DROP TABLE IF EXISTS "public"."group_capacity"; CREATE TABLE "public"."group_capacity" ( "id" int8 NOT NULL DEFAULT nextval('group_capacity_id_seq'::regclass), "group_id" varchar(128) COLLATE "pg_catalog"."default" NOT NULL, "quota" int4 NOT NULL, "usage" int4 NOT NULL, "max_size" int4 NOT NULL, "max_aggr_count" int4 NOT NULL, "max_aggr_size" int4 NOT NULL, "max_history_count" int4 NOT NULL, "gmt_create" timestamp(6) NOT NULL, "gmt_modified" timestamp(6) NOT NULL ) ; COMMENT ON COLUMN "public"."group_capacity"."id" IS '主键ID'; COMMENT ON COLUMN "public"."group_capacity"."group_id" IS 'Group ID,空字符表示整个集群'; COMMENT ON COLUMN "public"."group_capacity"."quota" IS '配额,0表示使用默认值'; COMMENT ON COLUMN "public"."group_capacity"."usage" IS '使用量'; COMMENT ON COLUMN "public"."group_capacity"."max_size" IS '单个配置大小上限,单位为字节,0表示使用默认值'; COMMENT ON COLUMN "public"."group_capacity"."max_aggr_count" IS '聚合子配置最大个数,,0表示使用默认值'; COMMENT ON COLUMN "public"."group_capacity"."max_aggr_size" IS '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值'; COMMENT ON COLUMN "public"."group_capacity"."max_history_count" IS '最大变更历史数量'; COMMENT ON COLUMN "public"."group_capacity"."gmt_create" IS '创建时间'; COMMENT ON COLUMN "public"."group_capacity"."gmt_modified" IS '修改时间'; COMMENT ON TABLE "public"."group_capacity" IS '集群、各Group容量信息表'; -- ---------------------------- -- Table structure for his_config_info -- ---------------------------- DROP TABLE IF EXISTS "public"."his_config_info"; CREATE TABLE "public"."his_config_info" ( "id" int8 NOT NULL, "nid" int8 NOT NULL DEFAULT nextval('his_config_info_nid_seq'::regclass), "data_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL, "group_id" varchar(128) COLLATE "pg_catalog"."default" NOT NULL, "app_name" varchar(128) COLLATE "pg_catalog"."default", "content" text COLLATE "pg_catalog"."default" NOT NULL, "md5" varchar(32) COLLATE "pg_catalog"."default", "gmt_create" timestamp(6) NOT NULL DEFAULT '2010-05-05 00:00:00'::timestamp without time zone, "gmt_modified" timestamp(6) NOT NULL, "src_user" text COLLATE "pg_catalog"."default", "src_ip" varchar(20) COLLATE "pg_catalog"."default", "op_type" char(10) COLLATE "pg_catalog"."default", "tenant_id" varchar(128) COLLATE "pg_catalog"."default", "encrypted_data_key" text COLLATE "pg_catalog"."default" NOT NULL ) ; COMMENT ON COLUMN "public"."his_config_info"."app_name" IS 'app_name'; COMMENT ON COLUMN "public"."his_config_info"."tenant_id" IS '租户字段'; COMMENT ON COLUMN "public"."his_config_info"."encrypted_data_key" IS '秘钥'; COMMENT ON TABLE "public"."his_config_info" IS '多租户改造'; -- ---------------------------- -- Table structure for permissions -- ---------------------------- DROP TABLE IF EXISTS "public"."permissions"; CREATE TABLE "public"."permissions" ( "role" varchar(50) COLLATE "pg_catalog"."default" NOT NULL, "resource" varchar(512) COLLATE "pg_catalog"."default" NOT NULL, "action" varchar(8) COLLATE "pg_catalog"."default" NOT NULL ) ; -- ---------------------------- -- Table structure for roles -- ---------------------------- DROP TABLE IF EXISTS "public"."roles"; CREATE TABLE "public"."roles" ( "username" varchar(50) COLLATE "pg_catalog"."default" NOT NULL, "role" varchar(50) COLLATE "pg_catalog"."default" NOT NULL ) ; -- ---------------------------- -- Table structure for tenant_capacity -- ---------------------------- DROP TABLE IF EXISTS "public"."tenant_capacity"; CREATE TABLE "public"."tenant_capacity" ( "id" int8 NOT NULL DEFAULT nextval('tenant_capacity_id_seq'::regclass), "tenant_id" varchar(128) COLLATE "pg_catalog"."default" NOT NULL, "quota" int4 NOT NULL, "usage" int4 NOT NULL, "max_size" int4 NOT NULL, "max_aggr_count" int4 NOT NULL, "max_aggr_size" int4 NOT NULL, "max_history_count" int4 NOT NULL, "gmt_create" timestamp(6) NOT NULL, "gmt_modified" timestamp(6) NOT NULL ) ; COMMENT ON COLUMN "public"."tenant_capacity"."id" IS '主键ID'; COMMENT ON COLUMN "public"."tenant_capacity"."tenant_id" IS 'Tenant ID'; COMMENT ON COLUMN "public"."tenant_capacity"."quota" IS '配额,0表示使用默认值'; COMMENT ON COLUMN "public"."tenant_capacity"."usage" IS '使用量'; COMMENT ON COLUMN "public"."tenant_capacity"."max_size" IS '单个配置大小上限,单位为字节,0表示使用默认值'; COMMENT ON COLUMN "public"."tenant_capacity"."max_aggr_count" IS '聚合子配置最大个数'; COMMENT ON COLUMN "public"."tenant_capacity"."max_aggr_size" IS '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值'; COMMENT ON COLUMN "public"."tenant_capacity"."max_history_count" IS '最大变更历史数量'; COMMENT ON COLUMN "public"."tenant_capacity"."gmt_create" IS '创建时间'; COMMENT ON COLUMN "public"."tenant_capacity"."gmt_modified" IS '修改时间'; COMMENT ON TABLE "public"."tenant_capacity" IS '租户容量信息表'; -- ---------------------------- -- Table structure for tenant_info -- ---------------------------- DROP TABLE IF EXISTS "public"."tenant_info"; CREATE TABLE "public"."tenant_info" ( "id" int8 NOT NULL DEFAULT nextval('tenant_info_id_seq'::regclass), "kp" varchar(128) COLLATE "pg_catalog"."default" NOT NULL, "tenant_id" varchar(128) COLLATE "pg_catalog"."default", "tenant_name" varchar(128) COLLATE "pg_catalog"."default", "tenant_desc" varchar(256) COLLATE "pg_catalog"."default", "create_source" varchar(32) COLLATE "pg_catalog"."default", "gmt_create" int8 NOT NULL, "gmt_modified" int8 NOT NULL ) ; COMMENT ON COLUMN "public"."tenant_info"."id" IS 'id'; COMMENT ON COLUMN "public"."tenant_info"."kp" IS 'kp'; COMMENT ON COLUMN "public"."tenant_info"."tenant_id" IS 'tenant_id'; COMMENT ON COLUMN "public"."tenant_info"."tenant_name" IS 'tenant_name'; COMMENT ON COLUMN "public"."tenant_info"."tenant_desc" IS 'tenant_desc'; COMMENT ON COLUMN "public"."tenant_info"."create_source" IS 'create_source'; COMMENT ON COLUMN "public"."tenant_info"."gmt_create" IS '创建时间'; COMMENT ON COLUMN "public"."tenant_info"."gmt_modified" IS '修改时间'; COMMENT ON TABLE "public"."tenant_info" IS 'tenant_info'; -- ---------------------------- -- Table structure for users -- ---------------------------- DROP TABLE IF EXISTS "public"."users"; CREATE TABLE "public"."users" ( "username" varchar(50) COLLATE "pg_catalog"."default" NOT NULL, "password" varchar(500) COLLATE "pg_catalog"."default" NOT NULL, "enabled" bool NOT NULL ) ; -- ---------------------------- -- Alter sequences owned by -- ---------------------------- ALTER SEQUENCE "public"."config_info_aggr_id_seq" OWNED BY "public"."config_info_aggr"."id"; SELECT setval('"public"."config_info_aggr_id_seq"', 2, false); -- ---------------------------- -- Alter sequences owned by -- ---------------------------- ALTER SEQUENCE "public"."config_info_beta_id_seq" OWNED BY "public"."config_info_beta"."id"; SELECT setval('"public"."config_info_beta_id_seq"', 2, false); -- ---------------------------- -- Alter sequences owned by -- ---------------------------- ALTER SEQUENCE "public"."config_info_id_seq" OWNED BY "public"."config_info"."id"; SELECT setval('"public"."config_info_id_seq"', 27, true); -- ---------------------------- -- Alter sequences owned by -- ---------------------------- ALTER SEQUENCE "public"."config_info_tag_id_seq" OWNED BY "public"."config_info_tag"."id"; SELECT setval('"public"."config_info_tag_id_seq"', 2, false); -- ---------------------------- -- Alter sequences owned by -- ---------------------------- ALTER SEQUENCE "public"."config_tags_relation_id_seq" OWNED BY "public"."config_tags_relation"."id"; SELECT setval('"public"."config_tags_relation_id_seq"', 2, false); -- ---------------------------- -- Alter sequences owned by -- ---------------------------- ALTER SEQUENCE "public"."config_tags_relation_nid_seq" OWNED BY "public"."config_tags_relation"."nid"; SELECT setval('"public"."config_tags_relation_nid_seq"', 2, false); -- ---------------------------- -- Alter sequences owned by -- ---------------------------- ALTER SEQUENCE "public"."group_capacity_id_seq" OWNED BY "public"."group_capacity"."id"; SELECT setval('"public"."group_capacity_id_seq"', 2, false); -- ---------------------------- -- Alter sequences owned by -- ---------------------------- ALTER SEQUENCE "public"."his_config_info_nid_seq" OWNED BY "public"."his_config_info"."nid"; SELECT setval('"public"."his_config_info_nid_seq"', 38, true); -- ---------------------------- -- Alter sequences owned by -- ---------------------------- ALTER SEQUENCE "public"."tenant_capacity_id_seq" OWNED BY "public"."tenant_capacity"."id"; SELECT setval('"public"."tenant_capacity_id_seq"', 2, false); -- ---------------------------- -- Alter sequences owned by -- ---------------------------- ALTER SEQUENCE "public"."tenant_info_id_seq" OWNED BY "public"."tenant_info"."id"; SELECT setval('"public"."tenant_info_id_seq"', 3, true); -- ---------------------------- -- Indexes structure for table config_info -- ---------------------------- CREATE UNIQUE INDEX "uk_configinfo_datagrouptenant" ON "public"."config_info" USING btree ( "data_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST, "group_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST, "tenant_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST ); -- ---------------------------- -- Primary Key structure for table config_info -- ---------------------------- ALTER TABLE "public"."config_info" ADD CONSTRAINT "config_info_pkey" PRIMARY KEY ("id"); -- ---------------------------- -- Indexes structure for table config_info_aggr -- ---------------------------- CREATE UNIQUE INDEX "uk_configinfoaggr_datagrouptenantdatum" ON "public"."config_info_aggr" USING btree ( "data_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST, "group_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST, "tenant_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST, "datum_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST ); -- ---------------------------- -- Primary Key structure for table config_info_aggr -- ---------------------------- ALTER TABLE "public"."config_info_aggr" ADD CONSTRAINT "config_info_aggr_pkey" PRIMARY KEY ("id"); -- ---------------------------- -- Indexes structure for table config_info_beta -- ---------------------------- CREATE UNIQUE INDEX "uk_configinfobeta_datagrouptenant" ON "public"."config_info_beta" USING btree ( "data_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST, "group_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST, "tenant_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST ); -- ---------------------------- -- Primary Key structure for table config_info_beta -- ---------------------------- ALTER TABLE "public"."config_info_beta" ADD CONSTRAINT "config_info_beta_pkey" PRIMARY KEY ("id"); -- ---------------------------- -- Indexes structure for table config_info_tag -- ---------------------------- CREATE UNIQUE INDEX "uk_configinfotag_datagrouptenanttag" ON "public"."config_info_tag" USING btree ( "data_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST, "group_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST, "tenant_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST, "tag_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST ); -- ---------------------------- -- Primary Key structure for table config_info_tag -- ---------------------------- ALTER TABLE "public"."config_info_tag" ADD CONSTRAINT "config_info_tag_pkey" PRIMARY KEY ("id"); -- ---------------------------- -- Indexes structure for table config_tags_relation -- ---------------------------- CREATE INDEX "idx_tenant_id" ON "public"."config_tags_relation" USING btree ( "tenant_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST ); CREATE UNIQUE INDEX "uk_configtagrelation_configidtag" ON "public"."config_tags_relation" USING btree ( "id" "pg_catalog"."int8_ops" ASC NULLS LAST, "tag_name" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST, "tag_type" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST ); -- ---------------------------- -- Primary Key structure for table config_tags_relation -- ---------------------------- ALTER TABLE "public"."config_tags_relation" ADD CONSTRAINT "config_tags_relation_pkey" PRIMARY KEY ("nid"); -- ---------------------------- -- Indexes structure for table group_capacity -- ---------------------------- CREATE UNIQUE INDEX "uk_group_id" ON "public"."group_capacity" USING btree ( "group_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST ); -- ---------------------------- -- Primary Key structure for table group_capacity -- ---------------------------- ALTER TABLE "public"."group_capacity" ADD CONSTRAINT "group_capacity_pkey" PRIMARY KEY ("id"); -- ---------------------------- -- Indexes structure for table his_config_info -- ---------------------------- CREATE INDEX "idx_did" ON "public"."his_config_info" USING btree ( "data_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST ); CREATE INDEX "idx_gmt_create" ON "public"."his_config_info" USING btree ( "gmt_create" "pg_catalog"."timestamp_ops" ASC NULLS LAST ); CREATE INDEX "idx_gmt_modified" ON "public"."his_config_info" USING btree ( "gmt_modified" "pg_catalog"."timestamp_ops" ASC NULLS LAST ); -- ---------------------------- -- Primary Key structure for table his_config_info -- ---------------------------- ALTER TABLE "public"."his_config_info" ADD CONSTRAINT "his_config_info_pkey" PRIMARY KEY ("nid"); -- ---------------------------- -- Indexes structure for table permissions -- ---------------------------- CREATE UNIQUE INDEX "uk_role_permission" ON "public"."permissions" USING btree ( "role" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST, "resource" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST, "action" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST ); -- ---------------------------- -- Indexes structure for table roles -- ---------------------------- CREATE UNIQUE INDEX "uk_username_role" ON "public"."roles" USING btree ( "username" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST, "role" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST ); -- ---------------------------- -- Indexes structure for table tenant_capacity -- ---------------------------- CREATE UNIQUE INDEX "uk_tenant_id" ON "public"."tenant_capacity" USING btree ( "tenant_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST ); -- ---------------------------- -- Primary Key structure for table tenant_capacity -- ---------------------------- ALTER TABLE "public"."tenant_capacity" ADD CONSTRAINT "tenant_capacity_pkey" PRIMARY KEY ("id"); -- ---------------------------- -- Indexes structure for table tenant_info -- ---------------------------- CREATE UNIQUE INDEX "uk_tenant_info_kptenantid" ON "public"."tenant_info" USING btree ( "kp" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST, "tenant_id" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST );
在项目的config模块的pom.xml文件中添加如下依赖:
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.3.3</version>
</dependency>
找到plugin下面的datasource,将mysql复制一份粘贴 重命名postgres
注意命名规范
每个类都检查一下,修改刚拷贝的几个类中LIMIT ?,?写法为OFFSET ? LIMIT ?,改完后可以复制sql去执行一下看看是否正常
找到DataSourceConstant新增一个常量 postgresql
依次修改为DataSourceConstant.POSTGRESQL
在项目的plugin模块的plugin/datasource/src/main/resources/META-INF/services/com.alibaba.nacos.plugin.datasource.mapper.Mapper增加如下内容:
com.alibaba.nacos.plugin.datasource.impl.postgres.ConfigInfoAggrMapperByPostgreSql
com.alibaba.nacos.plugin.datasource.impl.postgres.ConfigInfoBetaMapperByPostgreSql
com.alibaba.nacos.plugin.datasource.impl.postgres.ConfigInfoMapperByPostgreSql
com.alibaba.nacos.plugin.datasource.impl.postgres.ConfigInfoTagMapperByPostgreSql
com.alibaba.nacos.plugin.datasource.impl.postgres.ConfigTagsRelationMapperByPostgreSql
com.alibaba.nacos.plugin.datasource.impl.postgres.HistoryConfigInfoMapperByPostgreSql
com.alibaba.nacos.plugin.datasource.impl.postgres.TenantInfoMapperByPostgreSql
com.alibaba.nacos.plugin.datasource.impl.postgres.TenantCapacityMapperByPostgreSql
com.alibaba.nacos.plugin.datasource.impl.postgres.GroupCapacityMapperByPostgreSql
编译打包
mvn -Prelease-nacos clean install -Dmaven.test.skip=true -Dcheckstyle.skip=true
nacos.standalone=true
spring.datasource.platform=postgresql
db.num=1
### Connect URL of DB:
db.url.0=jdbc:postgresql://127.0.0.1:5432/tinker_config?currentSchema=public&reWriteBatchedInserts=true&useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
db.user.0=postgres
db.password.0=postgres
### Connection pool configuration: hikariCP
db.pool.config.driverClassName=org.postgresql.Driver
db.pool.config.connectionTimeout=30000
db.pool.config.validationTimeout=10000
db.pool.config.maximumPoolSize=20
db.pool.config.minimumIdle=2
开启鉴权
代码修改:plugins-defualt-impl模块,子模块nacos-default-auth-plugin中,修改com.alibaba.nacos.plugin.auth.impl.constant.AuthPageConstant
新增PersistenceConstant 的产量
public static final String POSTGRESQL = "postgresql";
新增
com.alibaba.nacos.plugin.auth.impl.persistence.handler.support.PostgreSqlPageHandlerAdapter
将mysql的复制一份改个名字即可将
本项目使用默认值,存在风险,详情见官方文档:
nacos不推荐暴露到公网
重新打包即可,根据官网配置修改配置文件
https://nacos.io/zh-cn/docs/v2/guide/user/auth.html
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。