Blackdread / sql-to-jdl

Tool to translate SQL databases to JDL format of jHipster (Created due to existing databases to be generated with jHipster and build angular-java web)
MIT License
179 stars 81 forks source link

Can't use with Postgresql 15.1 #175

Closed MonroeBrianJ closed 1 year ago

MonroeBrianJ commented 1 year ago

It worked fine with MySQL, but crashes with PostgreSQL 15.1.

Blackdread commented 1 year ago

Please provide more info, what is the error, etc. I executed the test "Postgres15Test" with docker image "postgres:15.1" and it succeeded.

MonroeBrianJ commented 1 year ago

log.txt

MonroeBrianJ commented 1 year ago

logging: level: jooq: trace org.blackdread.sqltojava: DEBUG

spring: datasource: type: com.zaxxer.hikari.HikariDataSource url: jdbc:postgresql://localhost:5432/alpine username: inspector password: password hikari: data-source-properties: cachePrepStmts: true prepStmtCacheSize: 250 prepStmtCacheSqlLimit: 2048 useServerPrepStmts: true jooq: sql-dialect: mysql

application: reserved-keywords: classpath:reserved/keywords.json database-to-export: alpine ignored-table-names:

Blackdread commented 1 year ago

Why do you have this setting?

jooq:
  sql-dialect: mysql

But your url is url: jdbc:postgresql://localhost:5432/alpine

Make sure to have latest changes of master branch, this is very different from current default master default config file.

Based on logs, no profile was set from configs so it used postgresql as it is defined in the url (which is correct). The bean InformationSchemaRepository should already be defined with PureSqlInformationSchemaRepository but it is missing, hard to know why.

Hard to help you further; integration tests are all green, I can also run it locally on my machine for mysql DB

MonroeBrianJ commented 1 year ago

Good catch. I tried sql-dialect: postgresql originally and that produced the same error.

I'll pull the latest and try it again. Maybe I have an old version.

MonroeBrianJ commented 1 year ago

I pulled the latest and ran into an issue with the maven wrapper. When I run ./mvnw clean install it tries to download maven and then errors out. I replaced the wrapper's .mvn folder with one from another project and then maven started working.

Now when I run ./mvnw --version I get this:

"Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63) Maven home: C:\Users\brian.m2\wrapper\dists\apache-maven-3.8.6-bin\67568434\apache-maven-3.8.6 Java version: 17.0.6, vendor: Amazon.com Inc., runtime: C:\Program Files\Amazon Corretto\jdk17.0.6_10 Default locale: en_US, platform encoding: Cp1252 OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows""

The tests run for a while (see the docker containers spawning) and then it fails with:

[INFO] Tests run: 15, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 132.229 s - in org.blackdread.sqltojava.test.db.mysql.MysqlLatestTest [INFO] [INFO] Results: [INFO] [ERROR] Errors: [ERROR] MariaDBLatestTest » IllegalState Could not find a valid Docker environment. Please see logs and check configuration [ERROR] Postgres09Test » IllegalState Could not find a valid Docker environment. Please see logs and check configuration [ERROR] PostgresUndefinedSkioTest » IllegalState Could not find a valid Docker environment. Please see logs and check configuration [ERROR] PostgresDatabaseObjectTypesConfigTest » IllegalState Could not find a valid Docker environment. Please see logs and check configuration [INFO] [ERROR] Tests run: 101, Failures: 0, Errors: 4, Skipped: 4 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 02:25 min [INFO] Finished at: 2023-02-19T08:46:27-07:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M9:test (default-test) on project sql-to-java: [ERROR] [ERROR] Please refer to C:\src\sql-to-jdl\target\surefire-reports for the individual test results. [ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream. [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Blackdread commented 1 year ago

you do not have docker running

MonroeBrianJ commented 1 year ago

Right, that's what the error is, but Docker is running. It gets through a bunch of tests, spawns several Docker containers and then it actually crashes Docker. I have to restart it to use it after that.

Blackdread commented 1 year ago

Well I cannot help much on that, it works on GitHub specs, runs on my machine and other people's machine. I close the ticket as this mostly an issue on your side, the code does work to generate the JDL.