From d10a064dfe4dc871930b1ce8163c2d4437de87b8 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Fri, 26 Jul 2019 10:56:27 +0200 Subject: [PATCH 1/6] [Store] Better debugs --- lib/src/Store.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/src/Store.dart b/lib/src/Store.dart index 1a6ac85..8073e53 100644 --- a/lib/src/Store.dart +++ b/lib/src/Store.dart @@ -59,7 +59,8 @@ class Store { onCreate: (Database db, int version) async { await createTables(db); }, onUpgrade: (Database db, int oldVersion, int newVersion) async { - print("Migrate databse from version $oldVersion to $newVersion"); + if (client.debug) + ("[Store] Migrate databse from version $oldVersion to $newVersion"); if (oldVersion != newVersion) { await db.execute("DROP TABLE IF EXISTS Rooms"); await db.execute("DROP TABLE IF EXISTS Participants"); @@ -90,7 +91,8 @@ class Store { ? null : clientList["prev_batch"], ); - print("Restore client credentials of ${client.userID}"); + if (client.debug) + print("[Store] Restore client credentials of ${client.userID}"); } else client.connection.onLoginStateChanged.add(LoginState.loggedOut); } From e1f83d8e830fcc094c147edb98b62fb687a96334 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Fri, 26 Jul 2019 10:57:44 +0200 Subject: [PATCH 2/6] [Store] Change DB version for testing --- lib/src/Store.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/Store.dart b/lib/src/Store.dart index 8073e53..066830d 100644 --- a/lib/src/Store.dart +++ b/lib/src/Store.dart @@ -55,7 +55,7 @@ class Store { _init() async { var databasePath = await getDatabasesPath(); String path = p.join(databasePath, "FluffyMatrix.db"); - _db = await openDatabase(path, version: 8, + _db = await openDatabase(path, version: 9, onCreate: (Database db, int version) async { await createTables(db); }, onUpgrade: (Database db, int oldVersion, int newVersion) async { From 9d5296d4e01b12d0bde300dba2031f0189d569f2 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Fri, 26 Jul 2019 11:00:39 +0200 Subject: [PATCH 3/6] [Store] Wait for table creation --- lib/src/Store.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/Store.dart b/lib/src/Store.dart index 066830d..9259ad4 100644 --- a/lib/src/Store.dart +++ b/lib/src/Store.dart @@ -55,7 +55,7 @@ class Store { _init() async { var databasePath = await getDatabasesPath(); String path = p.join(databasePath, "FluffyMatrix.db"); - _db = await openDatabase(path, version: 9, + _db = await openDatabase(path, version: 8, onCreate: (Database db, int version) async { await createTables(db); }, onUpgrade: (Database db, int oldVersion, int newVersion) async { @@ -69,7 +69,7 @@ class Store { await db.execute("DROP TABLE IF EXISTS NotificationsCache"); db.rawUpdate("UPDATE Clients SET prev_batch='' WHERE client=?", [client.clientName]); - createTables(db); + await createTables(db); } }); From 3441fb496406e495f7b85b67827c42e147812a52 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Fri, 26 Jul 2019 11:02:50 +0200 Subject: [PATCH 4/6] [Store] Switch db version for testing --- lib/src/Store.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/Store.dart b/lib/src/Store.dart index 9259ad4..64d1a49 100644 --- a/lib/src/Store.dart +++ b/lib/src/Store.dart @@ -55,7 +55,7 @@ class Store { _init() async { var databasePath = await getDatabasesPath(); String path = p.join(databasePath, "FluffyMatrix.db"); - _db = await openDatabase(path, version: 8, + _db = await openDatabase(path, version: 10, onCreate: (Database db, int version) async { await createTables(db); }, onUpgrade: (Database db, int oldVersion, int newVersion) async { From 582065bf3d517725155b5f6b3423924c90d462d9 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Fri, 26 Jul 2019 11:05:35 +0200 Subject: [PATCH 5/6] [Store] Fix debug --- lib/src/Store.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/src/Store.dart b/lib/src/Store.dart index 64d1a49..b5fc341 100644 --- a/lib/src/Store.dart +++ b/lib/src/Store.dart @@ -55,12 +55,13 @@ class Store { _init() async { var databasePath = await getDatabasesPath(); String path = p.join(databasePath, "FluffyMatrix.db"); - _db = await openDatabase(path, version: 10, + _db = await openDatabase(path, version: 11, onCreate: (Database db, int version) async { await createTables(db); }, onUpgrade: (Database db, int oldVersion, int newVersion) async { if (client.debug) - ("[Store] Migrate databse from version $oldVersion to $newVersion"); + print( + "[Store] Migrate databse from version $oldVersion to $newVersion"); if (oldVersion != newVersion) { await db.execute("DROP TABLE IF EXISTS Rooms"); await db.execute("DROP TABLE IF EXISTS Participants"); From 98d22aaedd7baca7c55c47bfa96b492adc33683b Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Fri, 26 Jul 2019 11:06:33 +0200 Subject: [PATCH 6/6] [Store] Back to prev db version --- lib/src/Store.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/Store.dart b/lib/src/Store.dart index b5fc341..df628a6 100644 --- a/lib/src/Store.dart +++ b/lib/src/Store.dart @@ -55,7 +55,7 @@ class Store { _init() async { var databasePath = await getDatabasesPath(); String path = p.join(databasePath, "FluffyMatrix.db"); - _db = await openDatabase(path, version: 11, + _db = await openDatabase(path, version: 8, onCreate: (Database db, int version) async { await createTables(db); }, onUpgrade: (Database db, int oldVersion, int newVersion) async {