Closed MatheusViniciusKuc closed 1 year ago
Hi @MatheusViniciusKuc! You didn't mention what migration tool you are using, if any. For instance, if you are using Flyway of Liquibase, there are corresponding preparers that you can utilize for that purpose - https://github.com/zonkyio/embedded-postgres#migrators-flyway-or-liquibase. If you are using a different migration tool, you have to implement a custom preparer. You can get some inspiration by checking out the existing preparers.
Regarding to the second question. Yes, it is possible to link the database with Hibernate, or even other database frameworks, but you have to do it on your own. There is no support for that in this library, because there is no integration with any dependency injection framework. However, if you are using Spring framework, you can consider using the following companion project https://github.com/zonkyio/embedded-database-spring-test that supports Hibernate and other tools out of the box.
Thanks
I have a postgres database, and I need to make a copy to use it for testing, I tried to do it with Postgres Preparer, but I couldn't.
You can use the pg_dump
utility to export the data from the database to a sql script and then use Flyway to execute the script when the application or test starts.
I need to create a database to perform tests, but I need to use the same schema as the structure that the database has in the application, would there be a way to do this, I tried a few ways and it didn't work. And one more thing would you use this bank created by the library in hibernate?