diff --git a/lib/database/database.dart b/lib/database/database.dart index 6e54bc21..592a2553 100644 --- a/lib/database/database.dart +++ b/lib/database/database.dart @@ -33,7 +33,7 @@ class Database extends _$Database { Database([QueryExecutor? executor]) : super(executor ?? _openConnection()); @override - int get schemaVersion => 2; + int get schemaVersion => 3; static LazyDatabase _openConnection() { return LazyDatabase(() async { @@ -52,6 +52,9 @@ class Database extends _$Database { await _resetOrders(); await _migrateRules(m); } + if (from < 3) { + await _repairLegacyProfileLabels(); + } }, beforeOpen: (details) async { // final m = Migrator(this); @@ -114,6 +117,12 @@ class Database extends _$Database { await rulesDao.resetOrders(); } + Future _repairLegacyProfileLabels() { + return customStatement( + "UPDATE profiles SET label = '' WHERE label IS NULL", + ); + } + Future restore( List profiles, List