-
Notifications
You must be signed in to change notification settings - Fork 38
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
Is this package usable for normal runtime (not test)? #292
Comments
Hi @VTrngNghia, thanks for your question. This project is tightly focused on integration with the Spring Test module, so I don't recommend using it in production, and I don't think it makes sense to do so. As an alternative, you might consider https://github.com/zonkyio/embedded-postgres, where you can easily create a postgres database using its internal API, see the example below. However, keep in mind that this is also a library primarily intended for testing. This means test dependencies like JUnit will be included in your project.. Such a decision needs to be carefully considered. EmbeddedPostgres.Builder builder = EmbeddedPostgres.builder();
EmbeddedPostgres pg = builder.start()
DataSource dataSource = pg.getPostgresDatabase(); |
Thanks @tomix26. The embedded-postgres seems to work.
I applied the flyway migration to it.
I see it's exposed via port
But attempts to connect to it from an external tool (for debugging) fails: I found the default username & password: |
The default postgres user cannot be changed. However, through the postgres database, you can create new users and databases using SQL commands. You can then connect to these databases using the |
For my service use case, I need to load the database from a PostGre .sql dump file onto memory (I'll try Flyway for that), extract some of the data, then discard the on-memory database. This is on a cron job, to be done weekly. I will do this on normal runtime, not just test time.
Is that possible to setup with this package?
I'm trying this config
But it's throwing error:
Note: I have multiple datasources & database types for my app (mongo, mysql,...) so the driver will probably need to be manually declared. The problem is, I don't know how...
The text was updated successfully, but these errors were encountered: