I have the following service in my docker-compose.yml file:
flyway:
image: boxfuse/flyway:latest-alpine
command: -url=jdbc:postgresql://yurldb:5432/yurldb -schemas=public -user=postgres -password=somepassword migrate
networks:
- yunet
volumes:
- ./flyway:/flyway/sql
restart: on-failure
depends_on:
- yurldb
And I have just one migration in my resources package:
When I run the service with docker compose (docker-compose up -d --build flyway) The flyway creates the flyway_schema_history table but doesn't create the table defined in the migration. If i check the logs i see this message:
Flyway Community Edition 5.2.4 by Boxfuse Database: jdbc:postgresql://yurldb:5432/yurldb (PostgreSQL 10.13) Successfully validated 0 migrations (execution time 00:00.011s) Current version of schema "public": << Empty Schema >> Schema "public" is up to date. No migration necessary.
The migration is not triggered. Why is that? I am not sure what I am missing. I have the migrations in the correct package and also the SQL inside is correct(else there would be some sort of syntax error). It just doesn't detect that migration. Any idea?
update I just noticed that when i run that command a little directory is created in the package structure. Not sure what it is:
I am also adding another picture to show also the overall structure of the project:
update 2
Using the volume mapping ./src/main/resources/db.migration:/flyway/sql
generated an additional directory in my package structure:
Change your mapping to this ./src/main/resources/db/migration:/flyway/sql
Using db.migration
causes Docker to create with that name, Intellij just shows the directory db/migration
like a package name db.dmigration
if the db directory has only directories in it.