ManualStepMigration is ignored at the first time (i.e. when DB version is 0)
Closed this issue · 2 comments
k-kagurazaka commented
Overview
ManualStepMigration
doesn't run if the dbVersion
is 0 (See this code).
However, Database#setVersion
is called at only ManualStepMigration
class, so when we add the first manual migration step to a project, the step will be ignored since the default dbVersion is 0.
k-kagurazaka commented
I pushed a repository to reproduce this issue (https://github.com/k-kagurazaka/orma-migration-issue).
Reproducing step is following:
- Run the app
- Change versionCode in
app/build.gradle
to2
- Rebuild and run the app
- This line is never called
Cause of this issue is that db version is still 0 after step 1 since OrmaConnection#migrationEngine
is SchemaDiffMigration
(not OrmaMigration
) when OrmaDatabase.Builder#migrationStep
is not called.
gfx commented
As described in #469, there were two independent issues on it:
ManualStepMigration
was not invoked if no migration step was defined, and thus the DB version was not initialized.ManualStepMigration
did not update the DB version if migration steps did not callexecSQL
and its wrappers (it was rare cases in production, though)
A new version 6.0.2 fixes these issues.