Setting Up the Database
Learn how to set up the database layer for the impure service using Flyway.
We'll cover the following
Migrations
The database layer should provide programmatic access to the database and also manage changes in the database. The latter is called migrations or evolutions. We will use Flyway as the tool to manage our database schema.
Flyway uses raw SQL scripts that have to be put into a certain location and follow certain naming conventions. This is the
/db/migration
(under the resources folder) in our case. The files also have to be named following the conventionVXX__some_name.sql
, whereXX
is the version number. Please note that there are two underscores between the version prefix and the rest of the name.
Because our database schema is straightforward, we get done quickly.
Get hands-on with 1400+ tech skills courses.