[Store] Wait for table creation

This commit is contained in:
Christian Pauly 2019-07-26 11:00:39 +02:00
parent e1f83d8e83
commit 9d5296d4e0

View file

@ -55,7 +55,7 @@ class Store {
_init() async { _init() async {
var databasePath = await getDatabasesPath(); var databasePath = await getDatabasesPath();
String path = p.join(databasePath, "FluffyMatrix.db"); 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 { onCreate: (Database db, int version) async {
await createTables(db); await createTables(db);
}, onUpgrade: (Database db, int oldVersion, int newVersion) async { }, onUpgrade: (Database db, int oldVersion, int newVersion) async {
@ -69,7 +69,7 @@ class Store {
await db.execute("DROP TABLE IF EXISTS NotificationsCache"); await db.execute("DROP TABLE IF EXISTS NotificationsCache");
db.rawUpdate("UPDATE Clients SET prev_batch='' WHERE client=?", db.rawUpdate("UPDATE Clients SET prev_batch='' WHERE client=?",
[client.clientName]); [client.clientName]);
createTables(db); await createTables(db);
} }
}); });