From f2892a672a495a78562836561f51a2a274cd16aa Mon Sep 17 00:00:00 2001
From: WangBQ <wangbinglilac@sina.com>
Date: 星期一, 29 五月 2023 10:26:10 +0800
Subject: [PATCH] !349 代码生成 从对应数据源加载表结构信息 存储到主数据源 实现存储统一 * 数据库脚本修改,gen_table增加data_name字段,存储对应数据源名称 * 代码生成 从对应数据源加载表结构信息 存储到主数据源 实现存储统一(表结构需要增加对应的数据来源字段) https://gitee.com/…

---
 script/sql/postgres/postgres_ry_vue_5.X.sql |   40 +++++++++++++++++++++-------------------
 1 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/script/sql/postgres/postgres_ry_vue_5.X.sql b/script/sql/postgres/postgres_ry_vue_5.X.sql
index 65857bf..b510042 100644
--- a/script/sql/postgres/postgres_ry_vue_5.X.sql
+++ b/script/sql/postgres/postgres_ry_vue_5.X.sql
@@ -100,7 +100,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 +157,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 +218,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 +261,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 +363,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, '瑙掕壊绠$悊鑿滃崟');
@@ -651,7 +651,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,
@@ -671,9 +671,9 @@
     constraint sys_oper_log_pk primary key (oper_id)
 );
 
-create unique index idx_sys_oper_log_bt ON sys_oper_log (business_type);
-create unique index idx_sys_oper_log_s ON sys_oper_log (status);
-create unique index idx_sys_oper_log_ot ON sys_oper_log (oper_time);
+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 '鏃ュ織涓婚敭';
@@ -702,7 +702,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,
@@ -747,7 +747,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,
@@ -817,7 +817,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,
@@ -859,7 +859,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,
@@ -871,8 +871,8 @@
     constraint sys_logininfor_pk primary key (info_id)
 );
 
-create unique index idx_sys_logininfor_s ON sys_logininfor (status);
-create unique index idx_sys_logininfor_lt ON sys_logininfor (login_time);
+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';
@@ -893,7 +893,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,
@@ -935,6 +935,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,
@@ -960,6 +961,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 '鍏宠仈瀛愯〃鐨勮〃鍚�';
@@ -1045,7 +1047,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,
@@ -1080,7 +1082,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,
@@ -1115,7 +1117,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