After we have the above configuration in place, we can run the migrations via the API of Flyway. For this, we have to load the configuration which we can do by creating an actor system. Then, we extract the needed information and create a JDBC url and use that with a username and password to obtain a Flyway instance. We simply call the method migrate(). Basically, this method will check if the schema exists and decide to either create it, apply pending migrations, or simply do nothing. The method will return the number of applied migrations.