From d1ef8f5eb3af6ae488d362152c1d78675281c489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Wed, 24 Aug 2022 18:03:09 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20postgresql=20?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=9F=A5=E8=AF=A2=E7=B1=BB=E5=9E=8B=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/sql/postgres/postgres_ry_vue_4.X.sql | 6 ++++++ script/sql/update/postgres/update-4.2-4.3.sql | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/script/sql/postgres/postgres_ry_vue_4.X.sql b/script/sql/postgres/postgres_ry_vue_4.X.sql index 2ff2cc5c..a0baed81 100644 --- a/script/sql/postgres/postgres_ry_vue_4.X.sql +++ b/script/sql/postgres/postgres_ry_vue_4.X.sql @@ -957,3 +957,9 @@ insert into sys_oss_config values (3, 'aliyun', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXX insert into sys_oss_config values (4, 'qcloud', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX', 'ruoyi-1250000000', '', 'cos.ap-beijing.myqcloud.com', '','N', 'ap-beijing', '1', '', 'admin', now(), 'admin', now(), null); insert into sys_oss_config values (5, 'image', 'ruoyi', 'ruoyi123', 'ruoyi', 'image', '127.0.0.1:9000', '','N', '', '1', '', 'admin', now(), 'admin', now(), NULL); +-- 字符串自动转时间 避免框架时间查询报错问题 +create or replace function cast_varchar_to_timestamp(varchar) returns timestamptz as $$ +select to_timestamp($1, 'yyyy-mm-dd hh24:mi:ss'); +$$ language sql strict ; + +create cast (varchar as timestamptz) with function cast_varchar_to_timestamp as IMPLICIT; diff --git a/script/sql/update/postgres/update-4.2-4.3.sql b/script/sql/update/postgres/update-4.2-4.3.sql index c8009373..8efbbd08 100644 --- a/script/sql/update/postgres/update-4.2-4.3.sql +++ b/script/sql/update/postgres/update-4.2-4.3.sql @@ -7,3 +7,10 @@ update sys_config set config_key = 'sys.account.captchaEnabled' where config_id insert into sys_menu values('1050', '账户解锁', '501', '4', '#', '', '', '1', '0', 'F', '0', '0', 'monitor:logininfor:unlock', '#', 'admin', now(), '', null, ''); insert into sys_role_menu values ('2', '1050'); + +-- 字符串自动转时间 避免框架时间查询报错问题 +create or replace function cast_varchar_to_timestamp(varchar) returns timestamptz as $$ +select to_timestamp($1, 'yyyy-mm-dd hh24:mi:ss'); +$$ language sql strict ; + +create cast (varchar as timestamptz) with function cast_varchar_to_timestamp as IMPLICIT;