-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TF-2310 Upgrade hive database to version 10
- Loading branch information
Showing
7 changed files
with
61 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
abstract class UpgradeDatabaseSteps { | ||
Future<void> onUpgrade(int oldVersion, int newVersion); | ||
} |
17 changes: 17 additions & 0 deletions
17
lib/features/base/upgradeable/upgrade_hive_database_steps_v10.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
import 'package:tmail_ui_user/features/base/upgradeable/upgrade_database_steps.dart'; | ||
import 'package:tmail_ui_user/features/caching/caching_manager.dart'; | ||
|
||
class UpgradeHiveDatabaseStepsV10 extends UpgradeDatabaseSteps { | ||
|
||
final CachingManager _cachingManager; | ||
|
||
UpgradeHiveDatabaseStepsV10(this._cachingManager); | ||
|
||
@override | ||
Future<void> onUpgrade(int oldVersion, int newVersion) async { | ||
if (oldVersion > 0 && oldVersion < newVersion && newVersion == 10) { | ||
await _cachingManager.clearLoginRecentData(); | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
lib/features/base/upgradeable/upgrade_hive_database_steps_v7.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
import 'package:tmail_ui_user/features/base/upgradeable/upgrade_database_steps.dart'; | ||
import 'package:tmail_ui_user/features/caching/caching_manager.dart'; | ||
|
||
class UpgradeHiveDatabaseStepsV7 extends UpgradeDatabaseSteps { | ||
|
||
final CachingManager _cachingManager; | ||
|
||
UpgradeHiveDatabaseStepsV7(this._cachingManager); | ||
|
||
@override | ||
Future<void> onUpgrade(int oldVersion, int newVersion) async { | ||
if (oldVersion > 0 && oldVersion < newVersion && newVersion == 7) { | ||
await _cachingManager.clearAll(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
class CacheVersion { | ||
static const int hiveDBVersion = 9; | ||
static const int hiveDBVersion = 10; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters