A user’s flight log exists nowhere else; clearing it is unrecoverable. There is no “clear data and re-create” path for anyone who has installed the app.
database_helper.dart is at databaseVersion = 5, with real _onUpgrade branches for
versions 2, 3, 4 and 5. Every future schema change adds another.
This file previously described a “pre-release, no migrations” strategy and told readers to clear app data on a schema change. That was written before release and was wrong by the time it was read — following it would destroy a user’s flight log. If you find that advice repeated anywhere else, it is stale.
databaseVersion in database_helper.dartif (oldVersion < N) branch to _onUpgrade, following the existing ones
(see :435, :451, :463, :503 for the current four)backfillDetectedDurationstest/duration_backfill_test.dart
is the pattern: annotate the migration @visibleForTesting and drive it directly, rather
than duplicating its SQL in the test where the two can drift apart_onCreate and _onUpgrade must converge on the
same schemaA good way to exercise a migration for real: copy an older dev_data/app_documents
database into a worktree and launch there, then check [DB:MIGRATE] in the log.
Fine on a dev machine, never appropriate as a user-facing fix.
bin/dev_run.sh --resetflights, sites, wings, wing_aliases, country_codes. Track points are not a
table — IGC files are stored on disk and read through FlightTrackLoader.
database_helper.dart — schema, migrations, low-level operationsdatabase_service.dart — main service layer with business logic