Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADD PG DATEBASE #1529

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<jjwt.version>0.9.0</jjwt.version>
<jackson-bom.version>2.11.1</jackson-bom.version>
<h2.version>2.1.214</h2.version>
<postgresql.version>42.2.19</postgresql.version>
<mockito.version>3.12.4</mockito.version>
<dubbo.version>3.0.5</dubbo.version>
<alibaba-dubbo.version>2.6.12</alibaba-dubbo.version>
Expand Down Expand Up @@ -112,6 +113,12 @@
<version>${h2.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-config</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
hippo4j.database.dialect=postgresql
hippo4j.database.init_enable=true
hippo4j.database.init_script=sql-script/postgresql/hippo4j_manager.sql
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres?currentSchema=hippo4j_manager
spring.datasource.username=admin
spring.datasource.password=admin123
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
mybatis-plus.configuration.map-underscore-to-camel-case=true
5 changes: 5 additions & 0 deletions threadpool/server/bootstrap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<!-- Adapter end -->
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
hippo4j.database.dialect=postgresql
hippo4j.database.init_enable=true
hippo4j.database.init_script=sql-script/postgresql/hippo4j_manager.sql
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres?currentSchema=hippo4j_manager
spring.datasource.username=root
spring.datasource.password=
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
CREATE TABLE IF NOT EXISTS "tenant" (
"id" bigserial PRIMARY KEY,
"tenant_id" varchar(128) DEFAULT NULL,
"tenant_name" varchar(128) DEFAULT NULL,
"tenant_desc" varchar(256) DEFAULT NULL,
"owner" varchar(32) DEFAULT '-',
"gmt_create" timestamp DEFAULT NULL,
"gmt_modified" timestamp DEFAULT NULL,
"del_flag" smallint DEFAULT NULL
);

CREATE TABLE IF NOT EXISTS "item" (
"id" bigserial PRIMARY KEY,
"tenant_id" varchar(128) DEFAULT NULL,
"item_id" varchar(128) DEFAULT NULL,
"item_name" varchar(128) DEFAULT NULL,
"item_desc" varchar(256) DEFAULT NULL,
"owner" varchar(32) DEFAULT NULL,
"gmt_create" timestamp DEFAULT NULL,
"gmt_modified" timestamp DEFAULT NULL,
"del_flag" smallint DEFAULT NULL
);

CREATE TABLE IF NOT EXISTS "config" (
"id" bigserial PRIMARY KEY,
"tenant_id" varchar(128) DEFAULT NULL,
"item_id" varchar(128) DEFAULT NULL,
"tp_id" varchar(256) DEFAULT NULL,
"tp_name" varchar(56) DEFAULT NULL,
"core_size" integer DEFAULT NULL,
"max_size" integer DEFAULT NULL,
"queue_type" integer DEFAULT NULL,
"capacity" integer DEFAULT NULL,
"rejected_type" integer DEFAULT NULL,
"keep_alive_time" integer DEFAULT NULL,
"execute_time_out" integer DEFAULT NULL,
"allow_core_thread_time_out" smallint DEFAULT NULL,
"content" text,
"md5" varchar(32) NOT NULL,
"is_alarm" smallint DEFAULT NULL,
"capacity_alarm" integer DEFAULT NULL,
"liveness_alarm" integer DEFAULT NULL,
"gmt_create" timestamp DEFAULT CURRENT_TIMESTAMP,
"gmt_modified" timestamp DEFAULT CURRENT_TIMESTAMP,
"del_flag" smallint DEFAULT NULL
);

CREATE TABLE IF NOT EXISTS "inst_config" (
"id" bigserial PRIMARY KEY,
"tenant_id" varchar(128) DEFAULT NULL,
"item_id" varchar(128) DEFAULT NULL,
"tp_id" varchar(256) DEFAULT NULL,
"instance_id" varchar(64) DEFAULT NULL,
"content" text,
"md5" varchar(32) NOT NULL,
"gmt_create" timestamp DEFAULT CURRENT_TIMESTAMP,
"gmt_modified" timestamp DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE IF NOT EXISTS "his_run_data" (
"id" bigserial PRIMARY KEY,
"tenant_id" varchar(128) DEFAULT NULL,
"item_id" varchar(128) DEFAULT NULL,
"tp_id" varchar(256) DEFAULT NULL,
"instance_id" varchar(64) DEFAULT NULL,
"current_load" bigint DEFAULT NULL,
"peak_load" bigint DEFAULT NULL,
"pool_size" bigint DEFAULT NULL,
"active_size" bigint DEFAULT NULL,
"queue_capacity" bigint DEFAULT NULL,
"queue_size" bigint DEFAULT NULL,
"queue_remaining_capacity" bigint DEFAULT NULL,
"completed_task_count" bigint DEFAULT NULL,
"reject_count" bigint DEFAULT NULL,
"timestamp" bigint DEFAULT NULL,
"gmt_create" timestamp DEFAULT NULL,
"gmt_modified" timestamp DEFAULT NULL
);

CREATE TABLE IF NOT EXISTS "log_record_info" (
"id" bigserial PRIMARY KEY,
"tenant" varchar(128) NOT NULL DEFAULT '',
"biz_key" varchar(128) NOT NULL DEFAULT '',
"biz_no" varchar(128) NOT NULL DEFAULT '',
"operator" varchar(64) NOT NULL DEFAULT '',
"action" varchar(128) NOT NULL DEFAULT '',
"category" varchar(128) NOT NULL DEFAULT '',
"detail" varchar(2048) NOT NULL DEFAULT '',
"create_time" timestamp DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE IF NOT EXISTS "user" (
"id" bigserial PRIMARY KEY,
"user_name" varchar(64) NOT NULL,
"password" varchar(512) NOT NULL,
"role" varchar(50) NOT NULL,
"gmt_create" timestamp NOT NULL,
"gmt_modified" timestamp NOT NULL,
"del_flag" smallint NOT NULL
);

CREATE TABLE IF NOT EXISTS "role" (
"id" bigserial PRIMARY KEY,
"role" varchar(64) NOT NULL,
"user_name" varchar(64) NOT NULL,
"gmt_create" timestamp NOT NULL,
"gmt_modified" timestamp NOT NULL,
"del_flag" smallint NOT NULL
);

CREATE TABLE IF NOT EXISTS "permission" (
"id" bigserial PRIMARY KEY,
"role" varchar(512) NOT NULL,
"resource" varchar(512) NOT NULL,
"action" varchar(8) NOT NULL,
"gmt_create" timestamp NOT NULL,
"gmt_modified" timestamp NOT NULL,
"del_flag" smallint NOT NULL
);

CREATE TABLE IF NOT EXISTS "notify" (
"id" bigserial PRIMARY KEY,
"tenant_id" varchar(128) NOT NULL DEFAULT '',
"item_id" varchar(128) NOT NULL,
"tp_id" varchar(256) NOT NULL,
"platform" varchar(32) NOT NULL,
"type" varchar(32) NOT NULL,
"secret_key" varchar(256) NOT NULL,
"interval" integer DEFAULT NULL,
"receives" varchar(512) NOT NULL,
"enable" smallint DEFAULT NULL,
"gmt_create" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"gmt_modified" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"del_flag" smallint NOT NULL
);

CREATE TABLE IF NOT EXISTS "his_config_verify" (
"id" bigserial PRIMARY KEY,
"type" integer DEFAULT NULL,
"mark" varchar(128) DEFAULT NULL,
"tenant_id" varchar(128) DEFAULT NULL,
"item_id" varchar(128) DEFAULT NULL,
"tp_id" varchar(256) DEFAULT NULL,
"identify" varchar(64) DEFAULT NULL,
"content" text,
"modify_all" smallint DEFAULT NULL,
"gmt_create" timestamp DEFAULT NULL,
"modify_user" varchar(128) DEFAULT NULL,
"verify_status" smallint DEFAULT NULL,
"gmt_verify" timestamp DEFAULT NULL,
"verify_user" varchar(128) DEFAULT NULL
);

INSERT INTO "tenant" ("id", "tenant_id", "tenant_name", "tenant_desc", "owner", "gmt_create", "gmt_modified", "del_flag") VALUES ('1', 'prescription', '处方组', '负责维护处方服务, 包括不限于电子处方等业务', '谢良辰', '2021-10-24 13:42:11', '2021-10-24 13:42:11', '0');

INSERT INTO "item" ("id", "tenant_id", "item_id", "item_name", "item_desc", "owner", "gmt_create", "gmt_modified", "del_flag") VALUES ('1', 'prescription', 'dynamic-threadpool-example', '动态线程池示例项目', '动态线程池示例项目,对应 Hippo 项目的 example 模块', '马称', '2021-10-24 16:11:00', '2021-10-24 16:11:00', '0');

INSERT INTO "config"("id","tenant_id","item_id","tp_id","tp_name","core_size","max_size","queue_type","capacity","rejected_type","keep_alive_time","allow_core_thread_time_out","content","md5","is_alarm","capacity_alarm","liveness_alarm","gmt_create","gmt_modified","del_flag")
VALUES ('1', 'prescription', 'dynamic-threadpool-example', 'message-consume', '示例消费者线程池', '5', '10', '9', '1024', '2', '9999', '0', '{\"tenantId\":\"prescription\",\"itemId\":\"dynamic-threadpool-example\",\"tpId\":\"message-consume\",\"coreSize\":5,\"maxSize\":10,\"queueType\":9,\"capacity\":1024,\"keepAliveTime\":9999,\"rejectedType\":2,\"isAlarm\":0,\"capacityAlarm\":80,\"livenessAlarm\":80,\"allowCoreThreadTimeOut\":0}', 'f80ea89044889fb6cec20e1a517f2ec3', '0', '80', '80', '2021-10-24 10:24:00', '2021-12-22 08:58:55', '0');

INSERT INTO "config"("id","tenant_id","item_id","tp_id","tp_name","core_size","max_size","queue_type","capacity","rejected_type","keep_alive_time","allow_core_thread_time_out","content","md5","is_alarm","capacity_alarm","liveness_alarm","gmt_create","gmt_modified","del_flag")
VALUES ('2', 'prescription', 'dynamic-threadpool-example', 'message-produce', '示例生产者线程池', '5', '15', '9', '1024', '1', '9999', '0', '{\"tenantId\":\"prescription\",\"itemId\":\"dynamic-threadpool-example\",\"tpId\":\"message-produce\",\"coreSize\":5,\"maxSize\":15,\"queueType\":9,\"capacity\":1024,\"keepAliveTime\":9999,\"rejectedType\":1,\"isAlarm\":0,\"capacityAlarm\":30,\"livenessAlarm\":30,\"allowCoreThreadTimeOut\":0}', '525e1429468bcfe98df7e70a75710051', '0', '30', '30', '2021-10-24 10:24:00', '2021-12-22 08:59:02', '0');
INSERT INTO "user" ("id", "user_name", "password", "role", "gmt_create", "gmt_modified", "del_flag") VALUES ('1', 'admin', '$2a$10$2KCqRbra0Yn2TwvkZxtfLuWuUP5KyCWsljO/ci5pLD27pqR3TV1vy', 'ROLE_ADMIN', '2021-11-04 21:35:17', '2021-11-15 23:04:59', '0');

INSERT INTO "notify" ("id", "tenant_id", "item_id", "tp_id", "platform", "type", "secret_key", "interval", "receives", "enable", "gmt_create", "gmt_modified", "del_flag") VALUES ('1', 'prescription', 'dynamic-threadpool-example', 'message-produce', 'DING', 'CONFIG', '4a582a588a161d6e3a1bd1de7eea9ee9f562cdfcbe56b6e72029e7fd512b2eae', NULL, '15601166691', '0', '2021-11-18 22:49:50', '2021-11-18 22:49:50', '0'), ('2', 'prescription', 'dynamic-threadpool-example', 'message-produce', 'DING', 'ALARM', '4a582a588a161d6e3a1bd1de7eea9ee9f562cdfcbe56b6e72029e7fd512b2eae', '30', '15601166691', '0', '2021-11-18 22:50:06', '2021-11-18 22:50:06', '0');