Migrate example to new opening callback

This commit is contained in:
Simon Binder 2019-06-22 19:02:25 +02:00
parent 151c374bfe
commit af5fca7dca
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
1 changed files with 8 additions and 4 deletions

View File

@ -45,10 +45,14 @@ class Database extends _$Database {
int get schemaVersion => 1;
@override
// todo migrate
MigrationStrategy get migration => MigrationStrategy(onFinished: () async {
MigrationStrategy get migration {
return MigrationStrategy(
beforeOpen: (engine, details) async {
// populate data
await into(categories)
await engine
.into(categories)
.insert(const CategoriesCompanion(description: Value('Sweets')));
});
},
);
}
}