Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何能将系统默认的Mysql转为Postgresql #2315

Open
RudolphLiu opened this issue Apr 16, 2024 · 0 comments
Open

如何能将系统默认的Mysql转为Postgresql #2315

RudolphLiu opened this issue Apr 16, 2024 · 0 comments

Comments

@RudolphLiu
Copy link

RudolphLiu commented Apr 16, 2024


name: 功能要求
about: 为 datart 提一个想法
title: '为Datart增加Postgresql支持'
labels: ''
assignees: ''


Datart版本号
1.0.0-rc.3

你的功能要求与某个问题相关吗?
最近由于工作中不可抗力因素,非得用postgres,于是手动想尝试改改代码,先看看反向生成到数据库是否可行,结果碰上第一个问题则是无法创建DatabaseMigration,因为执行的语句仍然是show tables,而postgres里面没这个。

形容一下你想要的解决方案
尝试将
List tables = jdbcTemplate.queryForList("SHOW TABLES", String.class);
改为:
List tables = jdbcTemplate.queryForList("SELECT tablename FROM pg_tables WHERE schemaname = 'public';", String.class);

修改了DatabaseMigration之后仍然是还不够。
报错org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [SHOW TABLES]; nested exception is org.postgresql.util.PSQLException: ERROR: unrecognized configuration parameter "tables"

描述一下你考虑过的备选方案
现在想了两个方案,第一个就是改代码,仍然倚靠它去生成到数据库,然后,继续跑Datart,第二种就是手动去把Mysql的表都转到postgresql里去,然后再跑Datart,再慢慢处理后续的问题

其他内容
转为PG是否可行,最好的方式是怎样的
希望能等到作者以及各位大佬的指点,目前只研究了一天时间,还在努力熟悉,期待能收到宝贵的建议

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant