Migrations in sqlite returns no error but it doesn't do anything
See original GitHub issueWhich version and edition of Flyway are you using?
6.4.4 (latest as today)
Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)
Gradle Plugin
Which database are you using (type & version)?
Sqlite 3.28.0 org.xerial:sqlite-jdbc:3.28.0
Which operating system are you using?
macOS Catalina 10.15.4 (19E287) Java info: openjdk 11.0.2 2019-01-15 OpenJDK Runtime Environment 18.9 (build 11.0.2+9) OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
What did you do?
I replaced postgres with sqlite on a legacy Spark project with Gradle. Everything works well (app and tests) if I create the database and run SQL from migrations manually using a 3rd. party db client. The issue here is flywayMigrate
command is not returning errors as if it ran correctly. But no database was created anywhere. Even if I created an empty file with the same name, it doesn’t apply migrations on it.
Repo: https://github.com/TwilioDevEd/browser-calls-spark/tree/next
Note: Make sure you are on the next
branch.
Easy to reproduce:
- Just clone, check out that branch
source .env.example
you don’t need the rest of the variables.- Execute the migration command
./gradle flywayMigrate
.
As a workaround, I had to create the DB manually using sqlite3 CLI so CI can pass.
What did you expect to see?
- Creating of the mydb.db file
- Migrations run on that file
What did you see instead?
❱ ./gradlew flywayMigrate -i
.
.
.
> Task :flywayMigrate
Caching disabled for task ':flywayMigrate' because:
Build cache is disabled
Task ':flywayMigrate' is not up-to-date because:
Task has not declared any outputs despite executing actions.
Database: jdbc:sqlite:mydb.db (SQLite 3.28)
Successfully validated 1 migration (execution time 00:00.000s)
Creating Schema History table "main"."flyway_schema_history" ...
Current version of schema "main": << Empty Schema >>
Migrating schema "main" to version 1 - Create ticket table
Successfully applied 1 migration to schema "main" (execution time 00:00.004s)
:flywayMigrate (Thread[Execution worker for ':',5,main]) completed. Took 0.246 secs.
BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed
But no mydb.db
file is created anywhere on the project.
❱ ./gradlew flywayInfo
> Task :flywayInfo
Schema version: 1
+-----------+---------+---------------------+------+---------------------+---------+
| Category | Version | Description | Type | Installed On | State |
+-----------+---------+---------------------+------+---------------------+---------+
| Versioned | 1 | Create ticket table | SQL | 2020-06-17 21:04:22 | Success |
+-----------+---------+---------------------+------+---------------------+---------+
BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
@po5i if you use
jdbc:h2:file:./mydb
, gradle flyway will create db file at~/.gradle/
if you want db file be created to current dir, you should use this config:
We have now documented how gradle relative paths work and this work around. Thank you.