Procházet zdrojové kódy

update 优化 移除删表语句 用户自行处理

疯狂的狮子Li před 2 roky
rodič
revize
5eb692dcdc
2 změnil soubory, kde provedl 0 přidání a 49 odebrání
  1. 0 24
      sql/postgres/postgres_ry_cloud.sql
  2. 0 25
      sql/ry-cloud.sql

+ 0 - 24
sql/postgres/postgres_ry_cloud.sql

@@ -69,7 +69,6 @@ comment on column  sys_social.del_flag          is '删除标志(0代表存在
 -- ----------------------------
 -- 租户表
 -- ----------------------------
-drop table if exists sys_tenant;
 create table if not exists sys_tenant
 (
     id                int8,
@@ -128,7 +127,6 @@ insert into sys_tenant values(1, '000000', '管理组', '15888888888', 'XXX有
 -- ----------------------------
 -- 租户套餐表
 -- ----------------------------
-drop table if exists sys_tenant_package;
 create table if not exists sys_tenant_package
 (
     package_id          int8,
@@ -164,7 +162,6 @@ comment on column  sys_tenant_package.update_time        is '更新时间';
 -- ----------------------------
 -- 1、部门表
 -- ----------------------------
-drop table if exists sys_dept;
 create table if not exists sys_dept
 (
     dept_id     int8,
@@ -221,7 +218,6 @@ insert into sys_dept values(109, '000000', 102, '0,100,102',  '财务部门',
 -- ----------------------------
 -- 2、用户信息表
 -- ----------------------------
-drop table if exists sys_user;
 create table if not exists sys_user
 (
     user_id     int8,
@@ -283,7 +279,6 @@ insert into sys_user VALUES(4, '000000', 102, 'test1', '仅本人 密码666666',
 -- ----------------------------
 -- 3、岗位信息表
 -- ----------------------------
-drop table if exists sys_post;
 create table if not exists sys_post
 (
     post_id     int8,
@@ -326,7 +321,6 @@ insert into sys_post values(4, '000000', 'user', '普通员工',  4, '0', 103, 1
 -- ----------------------------
 -- 4、角色信息表
 -- ----------------------------
-drop table if exists sys_role;
 create table if not exists sys_role
 (
     role_id             int8,
@@ -377,7 +371,6 @@ insert into sys_role values('4', '000000', '仅本人', 'test2', 4, '5', 't', 't
 -- ----------------------------
 -- 5、菜单权限表
 -- ----------------------------
-drop table if exists sys_menu;
 create table if not exists sys_menu
 (
     menu_id     int8,
@@ -574,7 +567,6 @@ INSERT INTO sys_menu VALUES('1511', '测试树表导出', '1506', '5', '#', '',
 -- ----------------------------
 -- 6、用户和角色关联表  用户N-1角色
 -- ----------------------------
-drop table if exists sys_user_role;
 create table if not exists sys_user_role
 (
     user_id int8 not null,
@@ -597,7 +589,6 @@ insert into sys_user_role values ('4', '4');
 -- ----------------------------
 -- 7、角色和菜单关联表  角色1-N菜单
 -- ----------------------------
-drop table if exists sys_role_menu;
 create table if not exists sys_role_menu
 (
     role_id int8 not null,
@@ -699,7 +690,6 @@ insert into sys_role_menu values ('4', '1511');
 -- ----------------------------
 -- 8、角色和部门关联表  角色1-N部门
 -- ----------------------------
-drop table if exists sys_role_dept;
 create table if not exists sys_role_dept
 (
     role_id int8 not null,
@@ -715,7 +705,6 @@ comment on column sys_role_dept.dept_id     is '部门ID';
 -- ----------------------------
 -- 9、用户与岗位关联表  用户1-N岗位
 -- ----------------------------
-drop table if exists sys_user_post;
 create table if not exists sys_user_post
 (
     user_id int8 not null,
@@ -735,7 +724,6 @@ insert into sys_user_post values ('1', '1');
 -- ----------------------------
 -- 10、操作日志记录
 -- ----------------------------
-drop table if exists sys_oper_log;
 create table if not exists sys_oper_log
 (
     oper_id        int8,
@@ -786,7 +774,6 @@ comment on column sys_oper_log.cost_time        is '消耗时间';
 -- ----------------------------
 -- 11、字典类型表
 -- ----------------------------
-drop table if exists sys_dict_type;
 create table if not exists sys_dict_type
 (
     dict_id     int8,
@@ -831,7 +818,6 @@ insert into sys_dict_type values(12, '000000', '设备类型', 'sys_device_type'
 -- ----------------------------
 -- 12、字典数据表
 -- ----------------------------
-drop table if exists sys_dict_data;
 create table if not exists sys_dict_data
 (
     dict_code   int8,
@@ -908,7 +894,6 @@ insert into sys_dict_data values(38, '000000', 0,  '小程序', 'xcx',         '
 -- ----------------------------
 -- 13、参数配置表
 -- ----------------------------
-drop table if exists sys_config;
 create table if not exists sys_config
 (
     config_id    int8,
@@ -950,7 +935,6 @@ insert into sys_config values(11, '000000', 'OSS预览列表资源开关',
 -- ----------------------------
 -- 14、系统访问记录
 -- ----------------------------
-drop table if exists sys_logininfor;
 create table if not exists sys_logininfor
 (
     info_id        int8,
@@ -988,7 +972,6 @@ comment on column sys_logininfor.login_time     is '访问时间';
 -- ----------------------------
 -- 17、通知公告表
 -- ----------------------------
-drop table if exists sys_notice;
 create table if not exists sys_notice
 (
     notice_id      int8,
@@ -1030,7 +1013,6 @@ insert into sys_notice values('2', '000000', '维护通知:2018-07-01 系统
 -- ----------------------------
 -- 18、代码生成业务表
 -- ----------------------------
-drop table if exists gen_table;
 create table if not exists gen_table
 (
     table_id          int8,
@@ -1085,7 +1067,6 @@ comment on column gen_table.remark is '备注';
 -- ----------------------------
 -- 19、代码生成业务表字段
 -- ----------------------------
-drop table if exists gen_table_column;
 create table if not exists gen_table_column
 (
     column_id      int8,
@@ -1142,7 +1123,6 @@ comment on column gen_table_column.update_time is '更新时间';
 -- ----------------------------
 -- OSS对象存储表
 -- ----------------------------
-drop table if exists sys_oss;
 create table if not exists sys_oss
 (
     oss_id        int8,
@@ -1177,7 +1157,6 @@ comment on column sys_oss.service           is '服务商';
 -- ----------------------------
 -- OSS对象存储动态配置表
 -- ----------------------------
-drop table if exists sys_oss_config;
 create table if not exists sys_oss_config
 (
     oss_config_id int8,
@@ -1235,7 +1214,6 @@ insert into sys_oss_config values (5, '000000', 'image',  'ruoyi',            'r
 -- ----------------------------
 -- 系统授权表
 -- ----------------------------
-drop table if exists sys_client;
 create table sys_client (
     id                  int8,
     client_id           varchar(64)   default ''::varchar,
@@ -1275,7 +1253,6 @@ comment on column sys_client.update_time            is '更新时间';
 insert into sys_client values (1, 'e5cd7e4891bf95d1d19206ce24a7b32e', 'pc', 'pc123', 'password,social', 'pc', 1800, 604800, 0, 0, 103, 1, now(), 1, now());
 insert into sys_client values (2, '428a8310cd442757ae699df5d894f051', 'app', 'app123', 'password,sms,social', 'android', 1800, 604800, 0, 0, 103, 1, now(), 1, now());
 
-DROP TABLE if EXISTS test_demo;
 create table if not exists test_demo
 (
     id          int8,
@@ -1310,7 +1287,6 @@ comment on column test_demo.update_time is '更新时间';
 comment on column test_demo.update_by is '更新人';
 comment on column test_demo.del_flag is '删除标志';
 
-DROP TABLE if EXISTS test_tree;
 create table if not exists test_tree
 (
     id          int8,

+ 0 - 25
sql/ry-cloud.sql

@@ -1,7 +1,6 @@
 -- ----------------------------
 -- 第三方平台授权表
 -- ----------------------------
-drop table if exists sys_social;
 create table sys_social
 (
     id                 bigint           not null        comment '主键',
@@ -39,7 +38,6 @@ create table sys_social
 -- ----------------------------
 -- 租户表
 -- ----------------------------
-drop table if exists sys_tenant;
 create table sys_tenant
 (
     id                bigint(20)    not null        comment 'id',
@@ -76,7 +74,6 @@ insert into sys_tenant values(1, '000000', '管理组', '15888888888', 'XXX有
 -- ----------------------------
 -- 租户套餐表
 -- ----------------------------
-drop table if exists sys_tenant_package;
 create table sys_tenant_package (
     package_id              bigint(20)     not null    comment '租户套餐id',
     package_name            varchar(20)                comment '套餐名称',
@@ -97,7 +94,6 @@ create table sys_tenant_package (
 -- ----------------------------
 -- 1、部门表
 -- ----------------------------
-drop table if exists sys_dept;
 create table sys_dept (
   dept_id           bigint(20)      not null                   comment '部门id',
   tenant_id         varchar(20)     default '000000'           comment '租户编号',
@@ -138,7 +134,6 @@ insert into sys_dept values(109, '000000', 102, '0,100,102',  '财务部门',
 -- ----------------------------
 -- 2、用户信息表
 -- ----------------------------
-drop table if exists sys_user;
 create table sys_user (
   user_id           bigint(20)      not null                   comment '用户ID',
   tenant_id         varchar(20)     default '000000'           comment '租户编号',
@@ -175,7 +170,6 @@ insert into sys_user values(4, '000000', 102, 'test1', '仅本人 密码666666',
 -- ----------------------------
 -- 3、岗位信息表
 -- ----------------------------
-drop table if exists sys_post;
 create table sys_post
 (
   post_id       bigint(20)      not null                   comment '岗位ID',
@@ -205,7 +199,6 @@ insert into sys_post values(4, '000000', 'user', '普通员工',  4, '0', 103, 1
 -- ----------------------------
 -- 4、角色信息表
 -- ----------------------------
-drop table if exists sys_role;
 create table sys_role (
   role_id              bigint(20)      not null                   comment '角色ID',
   tenant_id            varchar(20)     default '000000'           comment '租户编号',
@@ -237,7 +230,6 @@ insert into sys_role values(4, '000000', '仅本人',      'test2', 4, 5, 1, 1,
 -- ----------------------------
 -- 5、菜单权限表
 -- ----------------------------
-drop table if exists sys_menu;
 create table sys_menu (
   menu_id           bigint(20)      not null                   comment '菜单ID',
   menu_name         varchar(50)     not null                   comment '菜单名称',
@@ -412,7 +404,6 @@ insert into sys_menu values('1511', '测试树表导出',   '1506', '5', '#',
 -- ----------------------------
 -- 6、用户和角色关联表  用户N-1角色
 -- ----------------------------
-drop table if exists sys_user_role;
 create table sys_user_role (
   user_id   bigint(20) not null comment '用户ID',
   role_id   bigint(20) not null comment '角色ID',
@@ -430,7 +421,6 @@ INSERT INTO sys_user_role values ('4', '4');
 -- ----------------------------
 -- 7、角色和菜单关联表  角色1-N菜单
 -- ----------------------------
-drop table if exists sys_role_menu;
 create table sys_role_menu (
   role_id   bigint(20) not null comment '角色ID',
   menu_id   bigint(20) not null comment '菜单ID',
@@ -527,7 +517,6 @@ insert into sys_role_menu values ('4', '1511');
 -- ----------------------------
 -- 8、角色和部门关联表  角色1-N部门
 -- ----------------------------
-drop table if exists sys_role_dept;
 create table sys_role_dept (
   role_id   bigint(20) not null comment '角色ID',
   dept_id   bigint(20) not null comment '部门ID',
@@ -538,7 +527,6 @@ create table sys_role_dept (
 -- ----------------------------
 -- 9、用户与岗位关联表  用户1-N岗位
 -- ----------------------------
-drop table if exists sys_user_post;
 create table sys_user_post
 (
   user_id   bigint(20) not null comment '用户ID',
@@ -554,7 +542,6 @@ insert into sys_user_post values ('1', '1');
 -- ----------------------------
 -- 10、操作日志记录
 -- ----------------------------
-drop table if exists sys_oper_log;
 create table sys_oper_log (
   oper_id           bigint(20)      not null                   comment '日志主键',
   tenant_id         varchar(20)     default '000000'           comment '租户编号',
@@ -584,7 +571,6 @@ create table sys_oper_log (
 -- ----------------------------
 -- 11、字典类型表
 -- ----------------------------
-drop table if exists sys_dict_type;
 create table sys_dict_type
 (
   dict_id          bigint(20)      not null                   comment '字典主键',
@@ -616,7 +602,6 @@ insert into sys_dict_type values(12, '000000', '设备类型', 'sys_device_type'
 -- ----------------------------
 -- 12、字典数据表
 -- ----------------------------
-drop table if exists sys_dict_data;
 create table sys_dict_data
 (
   dict_code        bigint(20)      not null                   comment '字典编码',
@@ -675,7 +660,6 @@ insert into sys_dict_data values(38, '000000', 0,  '小程序', 'xcx',       'sy
 -- ----------------------------
 -- 13、参数配置表
 -- ----------------------------
-drop table if exists sys_config;
 create table sys_config (
   config_id         bigint(20)      not null                   comment '参数主键',
   tenant_id         varchar(20)     default '000000'           comment '租户编号',
@@ -702,7 +686,6 @@ insert into sys_config values(11, '000000', 'OSS预览列表资源开关',
 -- ----------------------------
 -- 14、系统访问记录
 -- ----------------------------
-drop table if exists sys_logininfor;
 create table sys_logininfor (
   info_id        bigint(20)     not null                  comment '访问ID',
   tenant_id      varchar(20)    default '000000'          comment '租户编号',
@@ -725,7 +708,6 @@ create table sys_logininfor (
 -- ----------------------------
 -- 17、通知公告表
 -- ----------------------------
-drop table if exists sys_notice;
 create table sys_notice (
   notice_id         bigint(20)      not null                   comment '公告ID',
   tenant_id         varchar(20)     default '000000'           comment '租户编号',
@@ -752,7 +734,6 @@ insert into sys_notice values('2', '000000', '维护通知:2018-07-01 系统
 -- ----------------------------
 -- 18、代码生成业务表
 -- ----------------------------
-drop table if exists gen_table;
 create table gen_table (
   table_id          bigint(20)      not null                   comment '编号',
   data_name         varchar(200)    default ''                 comment '数据源名称',
@@ -783,7 +764,6 @@ create table gen_table (
 -- ----------------------------
 -- 19、代码生成业务表字段
 -- ----------------------------
-drop table if exists gen_table_column;
 create table gen_table_column (
   column_id         bigint(20)      not null                   comment '编号',
   table_id          bigint(20)                                 comment '归属表编号',
@@ -814,7 +794,6 @@ create table gen_table_column (
 -- ----------------------------
 -- OSS对象存储表
 -- ----------------------------
-drop table if exists sys_oss;
 create table sys_oss (
   oss_id          bigint(20)   not null                   comment '对象存储主键',
   tenant_id       varchar(20)           default '000000'  comment '租户编号',
@@ -834,7 +813,6 @@ create table sys_oss (
 -- ----------------------------
 -- OSS对象存储动态配置表
 -- ----------------------------
-drop table if exists sys_oss_config;
 create table sys_oss_config (
   oss_config_id   bigint(20)    not null                  comment '主建',
   tenant_id       varchar(20)             default '000000'comment '租户编号',
@@ -869,7 +847,6 @@ insert into sys_oss_config values (5, '000000', 'image',  'ruoyi',            'r
 -- ----------------------------
 -- 系统授权表
 -- ----------------------------
-drop table if exists sys_client;
 create table sys_client (
     id                  bigint(20)    not null            comment 'id',
     client_id           varchar(64)   default null        comment '客户端id',
@@ -892,7 +869,6 @@ create table sys_client (
 insert into sys_client values (1, 'e5cd7e4891bf95d1d19206ce24a7b32e', 'pc', 'pc123', 'password,social', 'pc', 1800, 604800, 0, 0, 103, 1, sysdate(), 1, sysdate());
 insert into sys_client values (2, '428a8310cd442757ae699df5d894f051', 'app', 'app123', 'password,sms,social', 'android', 1800, 604800, 0, 0, 103, 1, sysdate(), 1, sysdate());
 
-DROP TABLE if EXISTS test_demo;
 CREATE TABLE test_demo
 (
     id          bigint(0)    NOT NULL COMMENT '主键',
@@ -912,7 +888,6 @@ CREATE TABLE test_demo
     PRIMARY KEY (id) USING BTREE
 ) ENGINE = InnoDB COMMENT = '测试单表';
 
-DROP TABLE if EXISTS test_tree;
 CREATE TABLE test_tree
 (
     id          bigint(0)    NOT NULL COMMENT '主键',