Refactor InAppDb.kt: move Room migrations into individual files and enable schema export

XMLWordPrintable

    • Type: Task
    • Resolution: Done
    • Priority: Low
    • 2.14
    • Affects Version/s: None
    • None
    • FLW Sprint 54, FLW Sprint 55
    • FLW Mobile App
    • UAT

      InAppDb.kt has grown to ~3,700 lines with 58 migrations written inline (DB version 70). Schema export is turned off (exportSchema = false), so DB changes are hard to review and can't be
      tested automatically. Several DB-upgrade field issues came from migrations.

      Scope:

      • Move each migration into its own file, e.g. database/room/migrations/Migration69To70.kt, with one registry file listing all migrations.
      • Remove commented-out and wrongly named migrations.
      • Set exportSchema = true, configure room.schemaLocation, and commit the generated schema JSON files under app/schemas/.
      • Add Room MigrationTestHelper tests covering upgrades from the oldest version still in the field to the current version.
      • Document the rule for future DB changes: new migration file + schema JSON + migration test, in the same PR.

      Acceptance Criteria:

      • [ ] InAppDb.kt contains no inline migration code.
      • [ ] Every migration is its own file and registered in one place.
      • [ ] Schema JSON files are committed for the current version.
      • [ ] Migration tests pass.
      • [ ] Upgrading from the current production version on a device keeps all existing data (no data loss, no re-sync).

      Note: no functional change. This is a refactor, so DB upgrade regression testing is mandatory.

              Assignee:
              Ishwar Chouhan
              Reporter:
              Nikhil Ananda Fegade
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: