Skip to content

Commit 76e64be

Browse files
committed
db: Debug-log a bit more on schema migrations
1 parent 3ae72ab commit 76e64be

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/model/database.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ class AppDatabase extends _$AppDatabase {
191191
);
192192

193193
Future<void> _createLatestSchema(Migrator m) async {
194+
assert(debugLog('Creating DB schema from scratch.'));
194195
await m.createAll();
195196
// Corresponds to `from4to5` above.
196197
await into(globalSettings).insert(GlobalSettingsCompanion());
@@ -205,7 +206,7 @@ class AppDatabase extends _$AppDatabase {
205206
// This should only ever happen in dev. As a dev convenience,
206207
// drop everything from the database and start over.
207208
// TODO(log): log schema downgrade as an error
208-
assert(debugLog('Downgrading schema from v$from to v$to.'));
209+
assert(debugLog('Downgrading DB schema from v$from to v$to.'));
209210

210211
// In the actual app, the target schema version is always
211212
// the latest version as of the code that's being run.
@@ -219,6 +220,7 @@ class AppDatabase extends _$AppDatabase {
219220
}
220221
assert(1 <= from && from <= to && to <= latestSchemaVersion);
221222

223+
assert(debugLog('Upgrading DB schema from v$from to v$to.'));
222224
await m.runMigrationSteps(from: from, to: to, steps: _migrationSteps);
223225
});
224226
}

0 commit comments

Comments
 (0)