-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
[BUG]DatabaseCreator validateTables fails when no table-prefix is set #1037
Comments
Hi @ibrok, thanks for reporting, we'll have a look and fix it asap. |
Could you please update your GitHub profile (like requested when you create an issue) and create a GitHub repo that reproduces this? |
I updated my profile, I missed that part, it helps if the instructions are a little shorter and to the point. [edit]reproduced it here as a fork of your example project: https://github.com/ibrok/example-order-fulfillment-bug clone project, run 'docker compose up' from project directory to start a postgres docker container then go to application.properties and uncomment line 7: org.jobrunr.database.skip-create=true Then go to application.properties again for the workaround and uncomment line 8: org.jobrunr.database.table-prefix=public. I think the validateTables shouldn't take the schema into account, or should default to the datasource schema if no prefix is set. Issue was introduced in version 7.1.1, if you set the jobrunr version to 7.1.0 there is no issue. |
Thank you! We'll take a look! |
JobRunr Version
7.1.1
JDK Version
17.0.0-tem
Your SQL / NoSQL database
Postgres 15.5
What happened?
We ran into issues while trying to update from version 6.3.5 to 7.1.1.
We manually add the migration scripts to flyway and have no table-prefix set in the spring configuration.
This worked fine for both our integration tests (which had a schema public), and our test and production environments which each have different database schema's. As we configure the schema in our flyway/datesource config, our sql scripts do not use or mention any schema in the migration scripts, just plain table names. (for configuration see how to reproduce section)
After updating to 7.1.1 we faced issues during startup, both during integration tests and on our test environment with following error:
Failed to instantiate [org.jobrunr.storage.StorageProvider]: Factory method 'sqlStorageProvider' threw exception with message: Not all required tables are available by JobRunr!
After reproducing the issue in a test and debugging it, it seems the DatabaseCreator.validateTables takes the tableSchema into account for the completeTableName, even when no schema or prefix is set. So the expectedTables contains no schema and prefix, while the completeTableName does include a schema.
A workaround for now for us is to set the table-prefix as follows:
But given as table-prefix appears to be an optional setting, the validateTables should probably not care about schema if table-prefix is not set.
How to reproduce?
We then wrote a unit test using the following spring annotations. The content of the test don't really matter much, as the failure is on spring context startup.
Relevant log output
The text was updated successfully, but these errors were encountered: