migration property Null safety
override
Defines the migration strategy that will determine how to deal with an increasing schemaVersion. The default value only supports creating the database by creating all tables known in this database. When you have changes in your schema, you'll need a custom migration strategy to create the new tables or change the columns.
Implementation
@override
MigrationStrategy get migration => MigrationStrategy(
onCreate: (Migrator m) async {
await m.createAll();
},
onUpgrade: (m, from, to) async {
// disable foreign_keys before migrations
await customStatement('PRAGMA foreign_keys = OFF');
},
beforeOpen: (details) async {
// foreign key references aren't enabled by default
await customStatement('PRAGMA foreign_keys = ON');
// collectionDao.
},
);