若依框架mysql数据迁移瀚高数据库注意事项

        <!-- postgresql-->
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.2.2</version>
        </dependency>

pom引入

org.postgresql.Driver
 
jdbc:postgresql://xxx:xxxx/xxx?currentSchema=dcs&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8

yml文件修改数据源 

1.date_format(date_sub(now(), interval 9 DAY), '%Y-%m-%d')类似写法改为TO_CHAR(NOW() - INTERVAL '9 DAY', 'YYYY-MM-DD')

2.convert(t.totalTime/t.totalNum, decimal(10,2)) 类似写法转为 ROUND(t.totalTime::numeric / t.totalNum::numeric, 2)

3.date_format(create_time, '%Y-%m-%d')转为to_char(create_time,'YYYY-MM-DD'

4.全局替换sysdate()至now()s

5.全局替换ifnull()至coalesce()

6.修改find_in_set(#{deptId}, ancestors)至cast(#{deptId} as varchar) = any(string_to_array(ancestors,‘,’))

7.修改Mapper中 status = 0 为 status = ‘0’

8.修改分页插件helperDialect为postgresq

 9.PostgreSQL 中,没有提供像 MySQL 的 INSERT IGNORE INTO 语法

INSERT INTO intface_app_auth (app_key, app_secret)
VALUES ('new_app_key', 'new_app_secret')
ON CONFLICT (app_key) DO NOTHING;

10.PostgreSQL 中查询后的字段的统一转化为小写,需加双引号

select to_char(create_time,'YYYY-MM-DD') as "callDate",count(*) as "totalNum"
from intface_reverse_history
where 1=1

猜你喜欢

转载自blog.csdn.net/qq_43632987/article/details/130573599
今日推荐