Skip to content

Commit 53ebe3b

Browse files
committed
db [nfc]: Use step-by-step migration helper
It is a thin wrapper that does what we are already doing in our migration code. While not required, an advantage of this is that it causes compilation errors for missing migration steps.
1 parent 0becd95 commit 53ebe3b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/model/database.dart

+7-7
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ class AppDatabase extends _$AppDatabase {
8686
}
8787
assert(1 <= from && from <= to && to <= schemaVersion);
8888

89-
if (from < 2 && 2 <= to) {
90-
final schema = Schema2(database: m.database);
91-
await m.addColumn(schema.accounts, schema.accounts.ackedPushToken);
92-
}
93-
// New migrations go here.
94-
}
95-
);
89+
await m.runMigrationSteps(from: from, to: to,
90+
steps: migrationSteps(
91+
from1To2: (m, schema) async {
92+
await m.addColumn(schema.accounts, schema.accounts.ackedPushToken);
93+
},
94+
));
95+
});
9696
}
9797

9898
Future<int> createAccount(AccountsCompanion values) async {

0 commit comments

Comments
 (0)