Skip to content

Commit

Permalink
ansible: skip validations before migration
Browse files Browse the repository at this point in the history
If existing migrations have already been applied, Flyway will by default
validate all of them before migrating.

Our Ansible playbook however only downloads the delta of migrations to
run, not the full history: so if there are existing migrations, the
playbook would fail.

Flyway has a flag ignoreMissingMigrations since 4.1.0, but our binary is
still based on 4.0 and upgrading it is quite hard unfortunately.

Luckily validateOnMigrate skips that validation as well, so it offers a good
workaround for now.

Signed-off-by: Pierre-Alexandre Meyer <[email protected]>
  • Loading branch information
pierre committed May 2, 2019
1 parent df2b2e7 commit a2fe265
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ansible/roles/migrations/tasks/migrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

- block:
- name: run SQL migration
command: "{{ flyway }} -locations=filesystem:{{ migration['dir'] }} -table={{ migration['table'] }} migrate"
command: "{{ flyway }} -locations=filesystem:{{ migration['dir'] }} -table={{ migration['table'] }} -validateOnMigrate=false migrate"
register: java_migrations
ignore_errors: True
tags: migrations
Expand Down

0 comments on commit a2fe265

Please sign in to comment.