Merge pull request #1819 from famedly/krille/create-missing-object-box
fix: Hotfix create missing objectbox
This commit is contained in:
commit
57625d0275
|
|
@ -19,12 +19,15 @@ class BoxCollection with ZoneTransactionMixin {
|
|||
Object? sqfliteDatabase,
|
||||
Object? sqfliteFactory,
|
||||
IdbFactory? idbFactory,
|
||||
int version = 1,
|
||||
}) async {
|
||||
idbFactory ??= window.indexedDB!;
|
||||
final db = await idbFactory.open(name, version: 1,
|
||||
final db = await idbFactory.open(name, version: version,
|
||||
onUpgradeNeeded: (VersionChangeEvent event) {
|
||||
final db = event.target.result;
|
||||
for (final name in boxNames) {
|
||||
if (db.objectStoreNames.contains(name)) continue;
|
||||
|
||||
db.createObjectStore(name, autoIncrement: true);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -218,6 +218,7 @@ class MatrixSdkDatabase extends DatabaseApi with DatabaseFileStorage {
|
|||
sqfliteDatabase: database,
|
||||
sqfliteFactory: sqfliteFactory,
|
||||
idbFactory: idbFactory,
|
||||
version: version,
|
||||
);
|
||||
_clientBox = _collection.openBox<String>(
|
||||
_clientBoxName,
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ class BoxCollection with ZoneTransactionMixin {
|
|||
Object? sqfliteDatabase,
|
||||
DatabaseFactory? sqfliteFactory,
|
||||
dynamic idbFactory,
|
||||
int version = 1,
|
||||
}) async {
|
||||
if (sqfliteDatabase is! Database) {
|
||||
throw ('You must provide a Database `sqfliteDatabase` for use on native.');
|
||||
|
|
|
|||
Loading…
Reference in New Issue