Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL Migration files seems detected twice and migration therefore failed. #1801

Closed
nelvadas opened this issue Oct 22, 2017 · 6 comments
Closed

Comments

@nelvadas
Copy link

What version of Flyway are you using?

4.2.0

Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin, SBT plugin, ANT tasks)

Command line

What database are you using (type & version)?

Postgres 9.6

What operating system are you using?

Containers:
Migration container Alpine Linux
DB container: centos

What did you do?

(Please include the content causing the issue, any relevant configuration settings, and the command you ran)
Trying to migrate apply a simple SQL Migration on a postgres DB from openshift, The data SQL are provided by a mounted volume .Files seems replicated at runtime and the migration failed with the error

In my /var/flyway/data I provided only one file.

When connecting to the migraiton container and run the command manually in debug mode i have htis

$/opt/flyway/4.2.0 # ./flyway info -user=root -password=Europa01# -url=jdbc:postgresql://beosbank-posgres-db-europa/beosbank-europa -locations=filesystem:/var/
flyway/data -X
Flyway 4.2.0 by Boxfuse

DEBUG: Java 1.8.0_131 (Oracle Corporation)
DEBUG: Linux 3.10.0-514.6.1.el7.x86_64 amd64

DEBUG: Loading config file: /opt/flyway/4.2.0/conf/flyway.conf
DEBUG: Unable to load config file: /root/flyway.conf
DEBUG: Unable to load config file: /opt/flyway/4.2.0/flyway.conf
DEBUG: Using configuration:
DEBUG: flyway.jarDirs -> /opt/flyway/4.2.0/jars
DEBUG: flyway.password -> *********
DEBUG: flyway.url -> jdbc:postgresql://beosbank-posgres-db-europa/beosbank-europa
DEBUG: flyway.user -> root
DEBUG: flyway.locations -> filesystem:/var/flyway/data
DEBUG: Adding location to classpath: /opt/flyway/4.2.0/drivers/derby-10.12.1.1.jar
DEBUG: Adding location to classpath: /opt/flyway/4.2.0/drivers/derbyclient-10.12.1.1.jar
DEBUG: Adding location to classpath: /opt/flyway/4.2.0/drivers/greenplumdriver-5.1.1.jar
DEBUG: Adding location to classpath: /opt/flyway/4.2.0/drivers/h2-1.4.193.jar
DEBUG: Adding location to classpath: /opt/flyway/4.2.0/drivers/hsqldb-2.3.4.jar
DEBUG: Adding location to classpath: /opt/flyway/4.2.0/drivers/jtds-1.3.1.jar
DEBUG: Adding location to classpath: /opt/flyway/4.2.0/drivers/mariadb-java-client-1.4.5.jar
DEBUG: Adding location to classpath: /opt/flyway/4.2.0/drivers/postgresql-9.4.1208.jre6.jar
DEBUG: Adding location to classpath: /opt/flyway/4.2.0/drivers/sqlite-jdbc-3.7.15-M1.jar
Database: jdbc:postgresql://beosbank-posgres-db-europa/beosbank-europa (PostgreSQL 9.6)
DEBUG: DDL Transactions Supported: true
DEBUG: Schema: public
DEBUG: Spring Jdbc available: false
DEBUG: Scanning for SQL callbacks ...
DEBUG: Scanning for filesystem resources at '/var/flyway/data' (Prefix: '', Suffix: '.sql')
DEBUG: Scanning for resources in path: /var/flyway/data (/var/flyway/data)
DEBUG: Scanning for resources in path: /var/flyway/data/..data (/var/flyway/data)
DEBUG: Scanning for resources in path: /var/flyway/data/..109810_21_10_22_56_31.560272816 (/var/flyway/data)
DEBUG: Found filesystem resource: /var/flyway/data/..109810_21_10_22_56_31.560272816/V3.0__UpdateStreet.sql
DEBUG: Found filesystem resource: /var/flyway/data/..data/V3.0__UpdateStreet.sql
DEBUG: Found filesystem resource: /var/flyway/data/V3.0__UpdateStreet.sql
DEBUG: Update Count: 0
DEBUG: Scanning for filesystem resources at '/var/flyway/data' (Prefix: 'V', Suffix: '.sql')
DEBUG: Scanning for resources in path: /var/flyway/data (/var/flyway/data)
DEBUG: Scanning for resources in path: /var/flyway/data/..data (/var/flyway/data)
DEBUG: Scanning for resources in path: /var/flyway/data/..109810_21_10_22_56_31.560272816 (/var/flyway/data)
DEBUG: Found filesystem resource: /var/flyway/data/..109810_21_10_22_56_31.560272816/V3.0__UpdateStreet.sql
DEBUG: Found filesystem resource: /var/flyway/data/..data/V3.0__UpdateStreet.sql
DEBUG: Found filesystem resource: /var/flyway/data/V3.0__UpdateStreet.sql
DEBUG: Scanning for filesystem resources at '/var/flyway/data' (Prefix: 'R', Suffix: '.sql')
DEBUG: Scanning for resources in path: /var/flyway/data (/var/flyway/data)
DEBUG: Scanning for resources in path: /var/flyway/data/..data (/var/flyway/data)
DEBUG: Scanning for resources in path: /var/flyway/data/..109810_21_10_22_56_31.560272816 (/var/flyway/data)
DEBUG: Filtering out resource: /var/flyway/data/..109810_21_10_22_56_31.560272816/V3.0__UpdateStreet.sql (filename: V3.0__UpdateStreet.sql)
DEBUG: Filtering out resource: /var/flyway/data/..data/V3.0__UpdateStreet.sql (filename: V3.0__UpdateStreet.sql)
DEBUG: Filtering out resource: /var/flyway/data/V3.0__UpdateStreet.sql (filename: V3.0__UpdateStreet.sql)
ERROR: Unexpected error
org.flywaydb.core.api.FlywayException: Found more than one migration with version 3.0
Offenders:
-> /var/flyway/data/..109810_21_10_22_56_31.560272816/V3.0__UpdateStreet.sql (SQL)
-> /var/flyway/data/V3.0__UpdateStreet.sql (SQL)
at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.checkForIncompatibilities(CompositeMigrationResolver.java:142)
at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.doFindAvailableMigrations(CompositeMigrationResolver.java:108)
at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.resolveMigrations(CompositeMigrationResolver.java:91)
at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.resolveMigrations(CompositeMigrationResolver.java:44)
at org.flywaydb.core.internal.info.MigrationInfoServiceImpl.refresh(MigrationInfoServiceImpl.java:112)
at org.flywaydb.core.Flyway$4.execute(Flyway.java:1115)
at org.flywaydb.core.Flyway$4.execute(Flyway.java:1097)
at org.flywaydb.core.Flyway.execute(Flyway.java:1464)
at org.flywaydb.core.Flyway.info(Flyway.java:1097)
at org.flywaydb.commandline.Main.executeOperation(Main.java:152)
at org.flywaydb.commandline.Main.main(Main.java:103)
/opt/flyway/4.2.0 #

What did you expect to see?

Migration successful

What did you see instead?

Unexpected file in the migration process
DEBUG: Found filesystem resource: /var/flyway/data/..109810_21_10_22_56_31.560272816/V3.0__UpdateStreet.sql

In my folder i put only one file V3.0__UpdateStreet.sql

RROR: Unexpected error
org.flywaydb.core.api.FlywayException: Found more than one migration with version 3.0
Offenders:
-> /var/flyway/data/..109810_21_10_22_56_31.560272816/V3.0__UpdateStreet.sql (SQL)
-> /var/flyway/data/V3.0__UpdateStreet.sql (SQL)
at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.checkForIncompatibilities(CompositeMigrationResolver.java:142)
at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.doFindAvailableMigrations(CompositeMigrationResolver.java:108)
at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.resolveMigrations(CompositeMigrationResolver.java:91)
at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.resolveMigrations(CompositeMigrationResolver.java:44)
at org.flywaydb.core.internal.info.MigrationInfoServiceImpl.refresh(MigrationInfoServiceImpl.java:112)
at org.flywaydb.core.Flyway$4.execute(Flyway.java:1115)
at org.flywaydb.core.Flyway$4.execute(Flyway.java:1097)
at org.flywaydb.core.Flyway.execute(Flyway.java:1464)
at org.flywaydb.core.Flyway.info(Flyway.java:1097)
at org.flywaydb.commandline.Main.executeOperation(Main.java:152)
at org.flywaydb.commandline.Main.main(Main.java:103)
/opt/flyway/4.2.0 #

@axelfontaine
Copy link
Contributor

It would appear you have this file in two different folders (as stated in the error message) and Flyway picks both up as it scans the location directories recursively. (Re)move one of the copies and it should work fine.

@nelvadas
Copy link
Author

Hi Axel, this is very strange of course, I placed only one file
/var/flyway/data/V3.0__UpdateStreet.sql
The second one /var/flyway/data/..109810_21_10_22_56_31.560272816/V3.0__UpdateStreet.sql
appear only when the flyway process is started.

@nelvadas
Copy link
Author

is there a way to deactivate scan only the specify folder and deactivate recursion? Thanks

@nelvadas
Copy link
Author

@axelfontaine Could you please reopen this item? As said previously I put only one file in the sql folder. Others may be created by a flyway process. Thanks

@EvanGertis
Copy link

This is still an issue I am trying to run a migration. The file directory only contains one copy of the schema file, but it detects 2 copies.

@kram0120
Copy link

I am having a similar issue, using the Java API. Does anyone have any additional information about this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants