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

Having only Repeatable Migrations crashes Flyway #1430

Closed
cristalp opened this issue Sep 13, 2016 · 13 comments
Closed

Having only Repeatable Migrations crashes Flyway #1430

cristalp opened this issue Sep 13, 2016 · 13 comments

Comments

@cristalp
Copy link

cristalp commented Sep 13, 2016

What version of Flyway are you using?

4.0.3

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)?

Oracle, SQL Server

What operating system are you using?

Red Hat Linux

What did you do?

We're using the new Repeatable Migration feature. However, in one of our JARs there was no migration script, just a Repeatable Migration script. Flyway apparently doesn't like that ;-)
ERROR: java.lang.ArrayIndexOutOfBoundsException: -1

What did you expect to see?

I would have liked the Repeatable Migration to be executed.

What did you see instead?

The error above

@axelfontaine
Copy link
Contributor

Could you please post the full stacktrace?

@cristalp
Copy link
Author

Sure:

Successfully validated 25 migrations (execution time 00:00.076s) SQLServer does not support setting the schema for the current session. Default schema NOT changed to dbo DEBUG: Schema [dbo] already exists. Skipping schema creation. DEBUG: Locking table [dbo].[schema_version]... DEBUG: Lock acquired for table [dbo].[schema_version] Current version of schema [dbo]: 2.1.0.35 WARNING: outOfOrder mode is active. Migration of schema [dbo] may not be reproducible. ERROR: Unexpected error java.lang.ArrayIndexOutOfBoundsException: -1 at org.flywaydb.core.internal.command.DbMigrate$2.doInTransaction(DbMigrate.java:201) at org.flywaydb.core.internal.command.DbMigrate$2.doInTransaction(DbMigrate.java:173) at org.flywaydb.core.internal.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:72) at org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:173) at org.flywaydb.core.Flyway$1.execute(Flyway.java:959) at org.flywaydb.core.Flyway$1.execute(Flyway.java:917) at org.flywaydb.core.Flyway.execute(Flyway.java:1373) at org.flywaydb.core.Flyway.migrate(Flyway.java:917) at org.flywaydb.commandline.Main.executeOperation(Main.java:139) at org.flywaydb.commandline.Main.main(Main.java:102)

@satahippy
Copy link

@cristalp do you apply migrations from different applications?
like you have one application that apply migrations from location1, and another from location2?

satahippy added a commit to satahippy/flyway that referenced this issue Sep 23, 2016
@cristalp
Copy link
Author

We have different applications that define the database server and schema with different paths, like db/migration/database/schema/V1.0.0__my_script.sql. During the build, all scripts found for an application are packed into a ZIP file. Then we have a shell script that takes the ZIP file, unpacks it and applies all migrations that it finds. Our Flyway configuration has a correspoding directory structure with /stage/database/schema/conf/flyway.conf
I hope I understood correctly what you were asking :-)

@satahippy
Copy link

Just we have the same issue.
We are using one database for different parts of application and each part has its own migrations set and they apply independently.
And i don't sure that flyway allow this 😄

@cristalp
Copy link
Author

Well, most of our application just use one database and leave the others alone. But there's one database which is used by most applications, and for that database we set outOfOrder to true, and we will probably also set validateOnMigrate=false, since some applied migrations from other applications may be missing for the application. It's ugly, I admit, but it's the only way it works.

@blai-cartera
Copy link

I believe I just ran into this error as well, even on 4.1.1 which has your commit beae6ff

However, the commit seems like it just adds some tests. Am I missing something?

@18thletter
Copy link

18thletter commented Mar 24, 2017

@blai-cartera I just ran into this as well. Looks like it's not fixed on 4.1.2.

@axelfontaine
Copy link
Contributor

@18thletter Please open a new issue and provide exact steps on how to reproduce.

@blai-cartera
Copy link

@axelfontaine FWIW, my steps previously were same as original ticket: just point flywaydb to target a folder that only has R_ scripts. Again, looking at the commits that seem associated with this issue #, I think I only see code changes to tests? Maybe the actual fix got lost somewhere or I'm a dummy and not seeing the changes :)

@axelfontaine
Copy link
Contributor

@jbrusis
Copy link

jbrusis commented Apr 11, 2017

I just ran into the same error with version 4.1.2. (command line).
Having configured a location on the filesystem that only contains repeatable migrations led to the same ArrayIndexOutOfBoundsException as above. I then added a versioned dummy script and it worked.

@axelfontaine
Copy link
Contributor

@jbrusis Please open a new issue and provide exact steps on how to reproduce.

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

6 participants