Skip to content

[Production readiness] Complete and test Drift schema migrations #392

Description

@jjoonleo

Summary

The Drift database schema is version 3, but the migration strategy only handles upgrades from version 1. There is no explicit path for users upgrading from version 2 to version 3.

Evidence

  • File: lib/core/database/database.dart
  • schemaVersion => 3.
  • onUpgrade checks only if (from == 1) and creates preparationSchedules and preparationUsers.
  • No migration branch handles from == 2 or validates intermediate migrations.

Why this is not production ready

  • Existing users can hit failed or incomplete local database migrations after app update.
  • Local schedule/preparation data may become unavailable or corrupted.
  • Migration bugs often appear only after release on real user devices.

Scope

Create complete, tested Drift migrations for all supported schema upgrade paths.

Suggested implementation

  • Determine what changed between schema versions 1, 2, and 3.
  • Implement stepwise migrations for 1 -> 2, 2 -> 3, and 1 -> 3 as appropriate.
  • Add migration tests with old schema fixtures or Migrator verification.
  • Confirm web Drift storage behavior if web persistence is supported.

Acceptance criteria

  • Upgrades from every supported previous schema version to current schema succeed.
  • Migration tests cover all expected upgrade paths.
  • Foreign keys remain enabled after migration.
  • Existing local data is preserved or intentionally transformed with documentation.

Project priority

P0 - User data safety blocker.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority: P0Critical production blockerproduction-readinessWork required before production release

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions