1. 程式人生 > >guns開源專案mysql資料庫切換為postgresql

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