guns开源项目mysql数据库切换为postgresql

1、数据转移

下载并安装软件dbconvert(dbconvert具体使用方法自行百度)

选择本地mysql以及对应表转为postgresql dump 对应表

执行sql(若报错,手动修改sql)

2、修改项目中pom文件以及数据源

3、运行项目报错找不到"id",原因是user是postgresql的关键字,查询语句需要加"",比如,select * from "user"。个人解决方案为修改user表名为usermgr。同时实体类添加注解:@TableName("usermgr")。

4、到这里已经能正常登陆系统,但是点击用户管理会报错,原因是UserMgrMapper.xml中的sql还未修改,将其中sql语句中的表名“user”修改为“usermgr”即可。

5、附postgresql保留字列表:https://www.postgresql.org/docs/9.4/static/sql-keywords-appendix.html

猜你喜欢

转载自blog.csdn.net/tianshuhao521/article/details/83343912