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

Location that only contains repeatable Migrations leads to ArrayIndexOutOfBounds #1885

Closed
ImmanuelRhesa opened this issue Jan 4, 2018 · 3 comments

Comments

@ImmanuelRhesa
Copy link

@ImmanuelRhesa ImmanuelRhesa commented Jan 4, 2018

What version of Flyway are you using?

5.0.4

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

Java API

What database are you using (type & version)?

5.7.19-log - MySQL Community Server (GPL)

What operating system are you using?

Windows 10

What did you do?

(Please include the content causing the issue, any relevant configuration settings, and the command you ran)
I am creating Spring Project and using Flyway for migration.
First I configured a folder on resource folder as location for the flyway migrations that contained versioned migration and then migrate. Migrate successfully.
After that I configured a folder on the resource folder as location for the flyway migrations that only contained Repeatable Migrations (default prefix and separator: R__).
I use flyway.setLocations to set which folder to migrate and set it to folder that contains only Repeatable migration. and then use flyway.migrate

What did you expect to see?

The migrate command executes successfully and all repeatable migrations (none of those scripts were executed before) are being executed against the configured DB

What did you see instead?
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
	at org.flywaydb.core.internal.command.DbMigrate.migrateGroup(DbMigrate.java:220)
	at org.flywaydb.core.internal.command.DbMigrate.access$300(DbMigrate.java:50)
	at org.flywaydb.core.internal.command.DbMigrate$4.call(DbMigrate.java:177)
	at org.flywaydb.core.internal.command.DbMigrate$4.call(DbMigrate.java:174)
	at org.flywaydb.core.internal.database.mysql.MySQLNamedLockTemplate.execute(MySQLNamedLockTemplate.java:60)
	at org.flywaydb.core.internal.database.mysql.MySQLConnection.lock(MySQLConnection.java:78)
	at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.lock(JdbcTableSchemaHistory.java:144)
	at org.flywaydb.core.internal.command.DbMigrate.migrateAll(DbMigrate.java:174)
	at org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:143)
	at org.flywaydb.core.Flyway$1.execute(Flyway.java:1206)
	at org.flywaydb.core.Flyway$1.execute(Flyway.java:1168)
	at org.flywaydb.core.Flyway.execute(Flyway.java:1650)
	at org.flywaydb.core.Flyway.migrate(Flyway.java:1168)
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Jan 4, 2018

Related to #1600

@axelfontaine axelfontaine added this to the Flyway 5.0.5 milestone Jan 4, 2018
axelfontaine added a commit to flyway/flywaydb.org that referenced this issue Jan 4, 2018
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Jan 4, 2018

Thank you very much for the detailed explanation and the stacktrace. This was a great help in recreating your scenario (which was very subtle): repeatable migrations only in combination with future migrations.

Fixed.

@ImmanuelRhesa
Copy link
Author

@ImmanuelRhesa ImmanuelRhesa commented Jan 5, 2018

Great, thanks for the fast response. I already tried with the 5.0.5 release and it already fixed

dohrayme pushed a commit to dohrayme/flyway that referenced this issue Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants