-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Flyway / DevServices #19766
Comments
/cc @cristhiank, @gastaldi, @geoand, @gsmet, @stuartwdouglas |
Sorry this might be hijacking the enhancement but, another solution could be that if a reactive datasource exists override the connection if it has not been defined and replace the prefix Based on the #33790 and #36012 which currently causes two devserivces to start, where one is for the reactive datasource and the other for the blocking 😅. |
Redacting my old comment with this one, a property that assigns that has the database devserice port assigned to it would be enought then I could just config |
Just noticed this issue... Which doesn't appear to be a flyway issue at all?
Regarding the "port" problem.... At first I was puzzled by the fact you were setting Then I got it: you want the two datasources to be backed by the same DB, and this is not what would happen if you were to use devservices on both datasources. So you tried to have devservices launched for one datasource, while having the other datasource point to the DB without launching a devservice. Is that right? If so, I think what you need is the concept of "shared" dev services, like here for AMQP, but unfortunately it is not implemented for datasources at the moment. If it was implemented, you could do something like this:
@geoand can you confirm this could work? Or would I be grossly misusing the concept of "shared" dev services? Note:
That being said... Everything would probably be much easier if you could just make a single datasource handle both reactive and JDBC. |
I am not really sure it would work as I anticipate there is no good way for the two different actions that are going to launch the devservice to coordinate. FWIW, |
Thanks @geoand , so indeed this would be abusing the feature. @gsmet told me that using a single datasource for both jdbc and reactive should actually work... I remember differently, but if this used to work at some point, it might be easy to fix. @pjgg could you try something like this, with a single datasource for both jdbc and reactive?
If the above does not work, you can alternatively try this:
|
Been following this issue so i gave it a try instead :)
And is worked
So the complicated setup with P.S. Using quarkus 3.8.1 P.P.S. CodeSystemInMemory uses the reactive datasource to query all data loaded from the
|
Great, thank you @agreedSkiing! I'll keep this open to at least add something to the documentation, as I suspect this is a common use case. |
The PR updating the documentation is ready, if anyone wants to give their opinion: #40313 |
Describe the bug
I am working with reactive Postgresql datasource and Flyway and I couldn't launch my app because I got the following error:
Failed to start application (with profile dev): org.postgresql.util.PSQLException: FATAL: database "store" does not exist
My configuration is the following one:
The problem is that flyway expects that
store
DB already exists, but doesn't because the container is instantiated by devService, and any other workaround would be an over-engineering solution, which is the opposite of devServices.Also, flyway requires the DB port, this could be handler by adding
quarkus.datasource.devservices.port
property but would be great to handler this without fixed ports.Proposal solution:
We could create a new (maybe optional) devServices property
quarkus.datasource.devservices.db-name
that could be used by:The port issue should be handler internally by the propagation of the port to the different places where is used. In case that end-user provides
quarkus.datasource.devservices.db-name
andquarkus.datasource.jdbc.url
thendb-name
will be used as a database name in Dev mode.The text was updated successfully, but these errors were encountered: