fix: Dont migrate from version null
If the currentVersion of the database is null then the database has never been used yet. Therefore we store the current version and do not call the migrate method.
This commit is contained in:
parent
36a9b53de1
commit
aeb808b5dc
|
|
@ -164,8 +164,14 @@ class FamedlySdkHiveDatabase extends DatabaseApi {
|
|||
_eventsBoxName,
|
||||
encryptionCipher: encryptionCipher,
|
||||
);
|
||||
final currentVersion = (await _clientBox.get('version') as int) ?? 0;
|
||||
if (currentVersion != version) await _migrateFromVersion(currentVersion);
|
||||
|
||||
// Check version and check if we need a migration
|
||||
final currentVersion = (await _clientBox.get('version') as int);
|
||||
if (currentVersion == null) {
|
||||
await _clientBox.put('version', version);
|
||||
} else if (currentVersion != version) {
|
||||
await _migrateFromVersion(currentVersion);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue