Flyway Docker-Compose Windows - SQL Files Not Found
I am attempting to migrate files with Flyway to an Azure Postgres database that already contains a table. I ran the flyway migrate command with the baseline environment variable equal to true and was able to successfully create the flyway_schema_history table and baseline the database. However, I get a warning that says no migrations found, yet I have migrations in the flyway/sql folder I think I am mounting:
postgres_flyway | Flyway OSS Edition 10.16.0 by Redgate postgres_flyway | postgres_flyway | See release notes here: https://rd.gt/416ObMi postgres_flyway | Schema history table "public"."flyway_schema_history" does not exist yet postgres_flyway | Successfully validated 0 migrations (execution time 00:00.155s) postgres_flyway | WARNING: No migrations found. Are your locations set up correctly? postgres_flyway | Creating Schema History table "public"."flyway_schema_history" with baseline ... postgres_flyway | Successfully baselined schema with version: 1 postgres_flyway | Current version of schema "public": 1 postgres_flyway | Schema "public" is up to date. No migration necessary. postgres_flyway exited with code 0
I think the problem may be that my directory and files are not being mounted like expected. Here is my docker-compose file:
services: flyway_migration: image: flyway/flyway container_name: postgres_flyway environment: FLYWAY_PASSWORD: redacted FLYWAY_USER: redacted FLYWAY_URL: redacted FLYWAY_CONNECT_RETRIES: 60 FLYWAY_BASELINE_ON_MIGRATE: true command: migrate volumes: - //ptl-chddc02b/user/Cloud/Desktop/postgres_flyway_dev/flyway/sql/:/flyway/sql
Note, The file name of the script I am trying to migrate is higher than the baseline version of 1 and contains two underscores V2__myMigration.sql
What I have tried:
- removing the slash after sql in the source section of the volume mount
- wrapping the source and target in single and double quotes
- I have confirmed the files have read, write and execute on my cloud desktop before I attempt to mount them
- I have provided a full qualified and relative path
Thank you for your help!
Answers
I believe this stackoverflow article might be of assistance here. Since you are trying to mount what looks like a network share, I believe additional parameters need to be added to your Docker compose.
Try those and let me know if it helps or not.
Kind regards,
Kurt McCormick
Product Support Engineer, Redgate
Need help? Take a look at our Help Center