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

ImmanuelRhesa opened this issue Jan 4, 2018 · 3 comments


Copy link

@ImmanuelRhesa ImmanuelRhesa commented Jan 4, 2018

What version of Flyway are you using?


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(
	at org.flywaydb.core.internal.command.DbMigrate.access$300(
	at org.flywaydb.core.internal.command.DbMigrate$
	at org.flywaydb.core.internal.command.DbMigrate$
	at org.flywaydb.core.internal.database.mysql.MySQLNamedLockTemplate.execute(
	at org.flywaydb.core.internal.database.mysql.MySQLConnection.lock(
	at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.lock(
	at org.flywaydb.core.internal.command.DbMigrate.migrateAll(
	at org.flywaydb.core.internal.command.DbMigrate.migrate(
	at org.flywaydb.core.Flyway$1.execute(
	at org.flywaydb.core.Flyway$1.execute(
	at org.flywaydb.core.Flyway.execute(
	at org.flywaydb.core.Flyway.migrate(
Copy link

@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/ that referenced this issue Jan 4, 2018
Copy link

@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.


Copy link

@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
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants