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

sqlite: flyway migrate fails, reports database is locked #1180

Closed
masc3d opened this issue Jan 24, 2016 · 5 comments
Closed

sqlite: flyway migrate fails, reports database is locked #1180

masc3d opened this issue Jan 24, 2016 · 5 comments

Comments

@masc3d
Copy link

@masc3d masc3d commented Jan 24, 2016

I'm trying to setup flyway with sqlite, org.xerial:sqlite-jdbc and gradle.
While baseline works fine, migrate always reports database is locked

Unable to restore autocommit to original value for connection
java.sql.SQLException: database is locked
    at org.sqlite.core.DB.throwex(DB.java:859)
    at org.sqlite.core.DB.exec(DB.java:142)
    at org.sqlite.jdbc3.JDBC3Connection.setAutoCommit(JDBC3Connection.java:155)
    at org.flywaydb.core.internal.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:96)
        ...
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Jan 24, 2016

How did you set up your datasource? Please include a small test case to reproduce.

@masc3d
Copy link
Author

@masc3d masc3d commented Jan 25, 2016

sure. happens with the most basic setup. https://github.com/masc3d/flyway-issue-1180

@masc3d
Copy link
Author

@masc3d masc3d commented Mar 30, 2016

issue persists with flyway/gradle-plugin 4.0. do you require more feedback?

@masc3d
Copy link
Author

@masc3d masc3d commented Mar 30, 2016

adding a task using flyway directly works pretty much flawlessly.

/** masc20160330. workaround for flyway bug https://github.com/flyway/flyway/issues/1180 */
task flywayMigrateWorkaround << {
    Flyway flyway = new Flyway();
    flyway.setDataSource("jdbc:sqlite:${db_file}", "", "");
    flyway.migrate();
}
tasks.flywayMigrateWorkaround.group = "flyway"

btw flywayClean fails as well. looks like flyway-gradle-plugin is pretty much incompatible with sqlite.

  Unable to drop "main"."sqlite_sequence"
  [SQLITE_ERROR] SQL error or missing database (table sqlite_sequence may not be dropped)

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Jan 25, 2017

Both the original and the sqlite_sequence issue have now been fixed. See my comment on #1499

Thanks for investigating!

axelfontaine added a commit to flyway/flywaydb.org that referenced this issue Jan 25, 2017
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