From 7accca933fac460a764df65589a39ea2ee240cea Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期三, 21 六月 2023 16:45:28 +0800
Subject: [PATCH] update 优化 powerjob-server docker编排

---
 script/sql/postgres/postgres_ry_vue_5.X.sql |  114 ++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 97 insertions(+), 17 deletions(-)

diff --git a/script/sql/postgres/postgres_ry_vue_5.X.sql b/script/sql/postgres/postgres_ry_vue_5.X.sql
index 4ad90df..a5123ce 100644
--- a/script/sql/postgres/postgres_ry_vue_5.X.sql
+++ b/script/sql/postgres/postgres_ry_vue_5.X.sql
@@ -1,4 +1,72 @@
 -- ----------------------------
+-- 绗笁鏂瑰钩鍙版巿鏉冭〃
+-- ----------------------------
+create table sys_social
+(
+    id                 int8             not null,
+    user_id            int8             not null,
+    tenant_id          varchar(20)      default null::varchar,
+    auth_id            varchar(255)     not null,
+    source             varchar(255)     not null,
+    open_id            varchar(255)     default null::varchar,
+    user_name          varchar(30)      not null,
+    nick_name          varchar(30)      default ''::varchar,
+    email              varchar(255)     default ''::varchar,
+    avatar             varchar(500)     default ''::varchar,
+    access_token       varchar(255)     not null,
+    expire_in          int8             default null::varchar,
+    refresh_token      varchar(255)     default null::varchar,
+    access_code        varchar(255)     default null::varchar,
+    union_id           varchar(255)     default null::varchar,
+    scope              varchar(255)     default null::varchar,
+    token_type         varchar(255)     default null::varchar,
+    id_token           varchar(255)     default null::varchar,
+    mac_algorithm      varchar(255)     default null::varchar,
+    mac_key            varchar(255)     default null::varchar,
+    code               varchar(255)     default null::varchar,
+    oauth_token        varchar(255)     default null::varchar,
+    oauth_token_secret varchar(255)     default null::varchar,
+    create_dept        int8,
+    create_by          int8,
+    create_time        timestamp,
+    update_by          int8,
+    update_time        timestamp,
+    del_flag           char             default '0'::bpchar,
+    constraint "pk_sys_social" primary key (id)
+);
+
+comment on table   sys_social                   is '绀句細鍖栧叧绯昏〃';
+comment on column  sys_social.id                is '涓婚敭';
+comment on column  sys_social.user_id           is '鐢ㄦ埛ID';
+comment on column  sys_social.tenant_id         is '绉熸埛id';
+comment on column  sys_social.auth_id           is '鎺堟潈+鎺堟潈openid';
+comment on column  sys_social.source            is '鐢ㄦ埛鏉ユ簮';
+comment on column  sys_social.open_id           is '鍘熺敓openid';
+comment on column  sys_social.user_name         is '鐧诲綍璐﹀彿';
+comment on column  sys_social.nick_name         is '鐢ㄦ埛鏄电О';
+comment on column  sys_social.email             is '鐢ㄦ埛閭';
+comment on column  sys_social.avatar            is '澶村儚鍦板潃';
+comment on column  sys_social.access_token      is '鐢ㄦ埛鐨勬巿鏉冧护鐗�';
+comment on column  sys_social.expire_in         is '鐢ㄦ埛鐨勬巿鏉冧护鐗岀殑鏈夋晥鏈燂紝閮ㄥ垎骞冲彴鍙兘娌℃湁';
+comment on column  sys_social.refresh_token     is '鍒锋柊浠ょ墝锛岄儴鍒嗗钩鍙板彲鑳芥病鏈�';
+comment on column  sys_social.access_code       is '骞冲彴鐨勬巿鏉冧俊鎭紝閮ㄥ垎骞冲彴鍙兘娌℃湁';
+comment on column  sys_social.union_id          is '鐢ㄦ埛鐨� unionid';
+comment on column  sys_social.scope             is '鎺堜簣鐨勬潈闄愶紝閮ㄥ垎骞冲彴鍙兘娌℃湁';
+comment on column  sys_social.token_type        is '涓埆骞冲彴鐨勬巿鏉冧俊鎭紝閮ㄥ垎骞冲彴鍙兘娌℃湁';
+comment on column  sys_social.id_token          is 'id token锛岄儴鍒嗗钩鍙板彲鑳芥病鏈�';
+comment on column  sys_social.mac_algorithm     is '灏忕背骞冲彴鐢ㄦ埛鐨勯檮甯﹀睘鎬э紝閮ㄥ垎骞冲彴鍙兘娌℃湁';
+comment on column  sys_social.mac_key           is '灏忕背骞冲彴鐢ㄦ埛鐨勯檮甯﹀睘鎬э紝閮ㄥ垎骞冲彴鍙兘娌℃湁';
+comment on column  sys_social.code              is '鐢ㄦ埛鐨勬巿鏉僣ode锛岄儴鍒嗗钩鍙板彲鑳芥病鏈�';
+comment on column  sys_social.oauth_token       is 'Twitter骞冲彴鐢ㄦ埛鐨勯檮甯﹀睘鎬э紝閮ㄥ垎骞冲彴鍙兘娌℃湁';
+comment on column  sys_social.oauth_token_secret is 'Twitter骞冲彴鐢ㄦ埛鐨勯檮甯﹀睘鎬э紝閮ㄥ垎骞冲彴鍙兘娌℃湁';
+comment on column  sys_social.create_dept       is '鍒涘缓閮ㄩ棬';
+comment on column  sys_social.create_by         is '鍒涘缓鑰�';
+comment on column  sys_social.create_time       is '鍒涘缓鏃堕棿';
+comment on column  sys_social.update_by         is '鏇存柊鑰�';
+comment on column  sys_social.update_time       is '鏇存柊鏃堕棿';
+comment on column  sys_social.del_flag          is '鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛�';
+
+-- ----------------------------
 -- 绉熸埛琛�
 -- ----------------------------
 drop table if exists sys_tenant;
@@ -100,7 +168,7 @@
 create table if not exists sys_dept
 (
     dept_id     int8,
-    tenant_id   varchar(20) not null,
+    tenant_id   varchar(20) default '000000'::varchar,
     parent_id   int8        default 0,
     ancestors   varchar(500)default ''::varchar,
     dept_name   varchar(30) default ''::varchar,
@@ -157,7 +225,7 @@
 create table if not exists sys_user
 (
     user_id     int8,
-    tenant_id   varchar(20)  not null,
+    tenant_id   varchar(20)  default '000000'::varchar,
     dept_id     int8,
     user_name   varchar(30)  not null,
     nick_name   varchar(30)  not null,
@@ -218,7 +286,7 @@
 create table if not exists sys_post
 (
     post_id     int8,
-    tenant_id   varchar(20) not null,
+    tenant_id   varchar(20) default '000000'::varchar,
     post_code   varchar(64) not null,
     post_name   varchar(50) not null,
     post_sort   int4        not null,
@@ -261,7 +329,7 @@
 create table if not exists sys_role
 (
     role_id             int8,
-    tenant_id           varchar(20)  not null,
+    tenant_id           varchar(20)  default '000000'::varchar,
     role_name           varchar(30)  not null,
     role_key            varchar(100) not null,
     role_sort           int4         not null,
@@ -363,7 +431,7 @@
 insert into sys_menu values('6', '绯荤粺绠$悊', '0', '2', 'tenant',           null, '', '1', '0', 'M', '0', '0', '', 'chart',    103, 1, now(), null, null, '绉熸埛绠$悊鐩綍');
 insert into sys_menu values('2', '绯荤粺鐩戞帶', '0', '3', 'monitor',          null, '', '1', '0', 'M', '0', '0', '', 'monitor',  103, 1, now(), null, null, '绯荤粺鐩戞帶鐩綍');
 insert into sys_menu values('3', '绯荤粺宸ュ叿', '0', '4', 'tool',             null, '', '1', '0', 'M', '0', '0', '', 'tool',     103, 1, now(), null, null, '绯荤粺宸ュ叿鐩綍');
-insert into sys_menu values('4', 'PLUS瀹樼綉', '0', '5', 'https://gitee.com/JavaLionLi/RuoYi-Vue-Plus', null, '', '0', '0', 'M', '0', '0', '', 'guide',    103, 1, now(), null, null, 'RuoYi-Vue-Plus瀹樼綉鍦板潃');
+insert into sys_menu values('4', 'PLUS瀹樼綉', '0', '5', 'https://gitee.com/dromara/RuoYi-Vue-Plus', null, '', '0', '0', 'M', '0', '0', '', 'guide',    103, 1, now(), null, null, 'RuoYi-Vue-Plus瀹樼綉鍦板潃');
 -- 浜岀骇鑿滃崟
 insert into sys_menu values('100',  '鐢ㄦ埛绠$悊',     '1',   '1', 'user',             'system/user/index',            '', '1', '0', 'C', '0', '0', 'system:user:list',            'user',          103, 1, now(), null, null, '鐢ㄦ埛绠$悊鑿滃崟');
 insert into sys_menu values('101',  '瑙掕壊绠$悊',     '1',   '2', 'role',             'system/role/index',            '', '1', '0', 'C', '0', '0', 'system:role:list',            'peoples',       103, 1, now(), null, null, '瑙掕壊绠$悊鑿滃崟');
@@ -385,8 +453,8 @@
 insert into sys_menu values('117',  'Admin鐩戞帶',   '2',   '5',  'Admin',            'monitor/admin/index',         '', '1', '0', 'C', '0', '0', 'monitor:admin:list',          'dashboard',     103, 1, now(), null, null, 'Admin鐩戞帶鑿滃崟');
 -- oss鑿滃崟
 insert into sys_menu values('118',  '鏂囦欢绠$悊',     '1',   '10', 'oss',              'system/oss/index',            '', '1', '0', 'C', '0', '0', 'system:oss:list',             'upload',        103, 1, now(), null, null, '鏂囦欢绠$悊鑿滃崟');
--- xxl-job-admin鎺у埗鍙�
-insert into sys_menu values('120',  '浠诲姟璋冨害涓績',  '2',   '5',  'XxlJob',           'monitor/xxljob/index',        '', '1', '0', 'C', '0', '0', 'monitor:xxljob:list',         'job',           103, 1, now(), null, null, 'Xxl-Job鎺у埗鍙拌彍鍗�');
+-- powerjob server鎺у埗鍙�
+insert into sys_menu values('120',  '浠诲姟璋冨害涓績',  '2',   '5',  'powerjob',           'monitor/powerjob/index',        '', '1', '0', 'C', '0', '0', 'monitor:powerjob:list',         'job',           103, 1, now(), null, null, 'PowerJob鎺у埗鍙拌彍鍗�');
 
 -- 涓夌骇鑿滃崟
 insert into sys_menu values('500',  '鎿嶄綔鏃ュ織', '108', '1', 'operlog',    'monitor/operlog/index',    '', '1', '0', 'C', '0', '0', 'monitor:operlog:list',    'form',          103, 1, now(), null, null, '鎿嶄綔鏃ュ織鑿滃崟');
@@ -651,7 +719,7 @@
 create table if not exists sys_oper_log
 (
     oper_id        int8,
-    tenant_id      varchar(20)   not null,
+    tenant_id      varchar(20)   default '000000'::varchar,
     title          varchar(50)   default ''::varchar,
     business_type  int4          default 0,
     method         varchar(100)  default ''::varchar,
@@ -667,8 +735,13 @@
     status         int4          default 0,
     error_msg      varchar(2000) default ''::varchar,
     oper_time      timestamp,
+    cost_time      int8          default 0,
     constraint sys_oper_log_pk primary key (oper_id)
 );
+
+create index idx_sys_oper_log_bt ON sys_oper_log (business_type);
+create index idx_sys_oper_log_s ON sys_oper_log (status);
+create index idx_sys_oper_log_ot ON sys_oper_log (oper_time);
 
 comment on table sys_oper_log                   is '鎿嶄綔鏃ュ織璁板綍';
 comment on column sys_oper_log.oper_id          is '鏃ュ織涓婚敭';
@@ -688,6 +761,7 @@
 comment on column sys_oper_log.status           is '鎿嶄綔鐘舵�侊紙0姝e父 1寮傚父锛�';
 comment on column sys_oper_log.error_msg        is '閿欒娑堟伅';
 comment on column sys_oper_log.oper_time        is '鎿嶄綔鏃堕棿';
+comment on column sys_oper_log.cost_time        is '娑堣�楁椂闂�';
 
 -- ----------------------------
 -- 11銆佸瓧鍏哥被鍨嬭〃
@@ -696,7 +770,7 @@
 create table if not exists sys_dict_type
 (
     dict_id     int8,
-    tenant_id   varchar(20)  not null,
+    tenant_id   varchar(20)  default '000000'::varchar,
     dict_name   varchar(100) default ''::varchar,
     dict_type   varchar(100) default ''::varchar,
     status      char         default '0'::bpchar,
@@ -709,7 +783,7 @@
     constraint sys_dict_type_pk primary key (dict_id)
 );
 
-CREATE UNIQUE INDEX sys_dict_type_index1 ON sys_dict_type (tenant_id, dict_type);
+create unique index sys_dict_type_index1 ON sys_dict_type (tenant_id, dict_type);
 
 comment on table sys_dict_type                  is '瀛楀吀绫诲瀷琛�';
 comment on column sys_dict_type.dict_id         is '瀛楀吀涓婚敭';
@@ -741,7 +815,7 @@
 create table if not exists sys_dict_data
 (
     dict_code   int8,
-    tenant_id   varchar(20)  not null,
+    tenant_id   varchar(20)  default '000000'::varchar,
     dict_sort   int4         default 0,
     dict_label  varchar(100) default ''::varchar,
     dict_value  varchar(100) default ''::varchar,
@@ -811,7 +885,7 @@
 create table if not exists sys_config
 (
     config_id    int8,
-    tenant_id    varchar(20)  not null,
+    tenant_id    varchar(20)  default '000000'::varchar,
     config_name  varchar(100) default ''::varchar,
     config_key   varchar(100) default ''::varchar,
     config_value varchar(500) default ''::varchar,
@@ -853,7 +927,7 @@
 create table if not exists sys_logininfor
 (
     info_id        int8,
-    tenant_id      varchar(20)  not null,
+    tenant_id      varchar(20)  default '000000'::varchar,
     user_name      varchar(50)  default ''::varchar,
     ipaddr         varchar(128) default ''::varchar,
     login_location varchar(255) default ''::varchar,
@@ -864,6 +938,9 @@
     login_time     timestamp,
     constraint sys_logininfor_pk primary key (info_id)
 );
+
+create index idx_sys_logininfor_s ON sys_logininfor (status);
+create index idx_sys_logininfor_lt ON sys_logininfor (login_time);
 
 comment on table sys_logininfor                 is '绯荤粺璁块棶璁板綍';
 comment on column sys_logininfor.info_id        is '璁块棶ID';
@@ -884,7 +961,7 @@
 create table if not exists sys_notice
 (
     notice_id      int8,
-    tenant_id      varchar(20)  not null,
+    tenant_id      varchar(20)  default '000000'::varchar,
     notice_title   varchar(50)  not null,
     notice_type    char         not null,
     notice_content text,
@@ -926,6 +1003,7 @@
 create table if not exists gen_table
 (
     table_id          int8,
+    data_name         varchar(200)  default ''::varchar,
     table_name        varchar(200)  default ''::varchar,
     table_comment     varchar(500)  default ''::varchar,
     sub_table_name    varchar(64)   default ''::varchar,
@@ -940,6 +1018,7 @@
     gen_type          char          default '0'::bpchar not null,
     gen_path          varchar(200)  default '/'::varchar,
     options           varchar(1000) default null::varchar,
+    create_dept       int8,
     create_by         int8,
     create_time       timestamp,
     update_by         int8,
@@ -950,6 +1029,7 @@
 
 comment on table gen_table is '浠g爜鐢熸垚涓氬姟琛�';
 comment on column gen_table.table_id is '缂栧彿';
+comment on column gen_table.data_name is '鏁版嵁婧愬悕绉�';
 comment on column gen_table.table_name is '琛ㄥ悕绉�';
 comment on column gen_table.table_comment is '琛ㄦ弿杩�';
 comment on column gen_table.sub_table_name is '鍏宠仈瀛愯〃鐨勮〃鍚�';
@@ -1035,7 +1115,7 @@
 create table if not exists sys_oss
 (
     oss_id        int8,
-    tenant_id     varchar(20)  not null,
+    tenant_id     varchar(20)  default '000000'::varchar,
     file_name     varchar(255) default ''::varchar not null,
     original_name varchar(255) default ''::varchar not null,
     file_suffix   varchar(10)  default ''::varchar not null,
@@ -1070,7 +1150,7 @@
 create table if not exists sys_oss_config
 (
     oss_config_id int8,
-    tenant_id     varchar(20)  not null,
+    tenant_id     varchar(20)  default '000000'::varchar,
     config_key    varchar(20)  default ''::varchar not null,
     access_key    varchar(255) default ''::varchar,
     secret_key    varchar(255) default ''::varchar,
@@ -1105,7 +1185,7 @@
 comment on column sys_oss_config.is_https       is '鏄惁https锛圷=鏄�,N=鍚︼級';
 comment on column sys_oss_config.region         is '鍩�';
 comment on column sys_oss_config.access_policy  is '妗舵潈闄愮被鍨�(0=private 1=public 2=custom)';
-comment on column sys_oss_config.status         is '鐘舵�侊紙0=姝e父,1=鍋滅敤锛�';
+comment on column sys_oss_config.status         is '鏄惁榛樿锛�0=鏄�,1=鍚︼級';
 comment on column sys_oss_config.ext1           is '鎵╁睍瀛楁';
 comment on column sys_oss_config.create_dept    is '鍒涘缓閮ㄩ棬';
 comment on column sys_oss_config.create_by      is '鍒涘缓鑰�';

--
Gitblit v1.9.3