Using a Java class for DB migration
Hi! I got some good feedback from @phxql@fosstodon.org related to my previous post: with flyway it’s possible to have a JavaMigration, which let’s you write custom code. So let’s test this out today! JavaMigration It took me a while to make this work. I couldn’t figure it out what it was meant by adding the class to the db.migration package. Some places mentioned src/db/migration, some places mentioned src/main/java/db/migration and I even tried src/main/resources/db/migration (shouldn’t work, but here are my SQL files), but it was fruitless. In the end, @ComponentScan helped me again, as I created a new sub-package migration in my Spring project and annotated my class with @Component, that made it work, with the added benefit of allowing me to control the location of the files. ...