Skip to content

fix(android): register v2→v3 and v3→v4 Room migrations, bump DB to v4 - #23

Merged
Hidden-Node merged 2 commits into
mainfrom
advisor/011-room-migrations-v4
Aug 1, 2026
Merged

fix(android): register v2→v3 and v3→v4 Room migrations, bump DB to v4#23
Hidden-Node merged 2 commits into
mainfrom
advisor/011-room-migrations-v4

Conversation

@Hidden-Node

Copy link
Copy Markdown
Owner

Registers real Room migrations for the two schema gaps that crash existing
users upgrading to this build, and bumps the DB version to 4 so Room has a
version delta to act on.

Why:

  • v2→v3: v1.0.1 bumped version 2→3 without a migration and relied on
    fallbackToDestructiveMigration (removed in plan 003). Any user still on a
    v2 DB now hits "A migration from 2 to 3 was required but not found".
  • Within-v3: all v1.0.1–v1.0.6 builds are version 3, but the schema drifted
    (coalesceStepMs, idleSlotsPerBucket, remoteUrl added without a version
    bump), so old v3 DBs crash on "no such column" for every SELECT *.

Changes:

  • ProfileMigrations.ALL = [Migration(2,3), Migration(3,4)]; both use an
    existingColumns() guard so one Migration(3,4) handles both live v3 shapes
    (13- and 15-column) and stays idempotent.
  • AppDatabase version 3 → 4.
  • Commit Room schema JSONs for v2/v3/v4 (enables AutoMigration for future
    column adds).
  • Add sqlite-jdbc test dep + ProfileMigrationsTest (5 JVM cases: registration
    wiring, v2→v4 data preservation, both v3 variants, idempotency).

Tests: ./gradlew :app:testDebugUnitTest → BUILD SUCCESSFUL, 5/5 pass.

@Hidden-Node
Hidden-Node merged commit 2ce3913 into main Aug 1, 2026
1 check passed
@Hidden-Node
Hidden-Node deleted the advisor/011-room-migrations-v4 branch August 1, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant