Fix DB queries

This commit is contained in:
vishnukvmd 2022-11-01 15:21:53 +05:30
parent b556204921
commit 1b2e677abe

View file

@ -40,16 +40,16 @@ class AuthenticatorDB {
await db.execute( await db.execute(
''' '''
CREATE TABLE $entityTable ( CREATE TABLE $entityTable (
_generatedID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, _generatedID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
id TEXT, id TEXT,
encryptedData TEXT NOT NULL, encryptedData TEXT NOT NULL,
header TEXT NOT NULL, header TEXT NOT NULL,
createdAt INTEGER NOT NULL, createdAt INTEGER NOT NULL,
updatedAt INTEGER NOT NULL, updatedAt INTEGER NOT NULL,
shouldSync INTERGER DEFAULT 0 shouldSync INTEGER DEFAULT 0,
UNIQUE(id)
); );
CREATE UNIQUE INDEX entity_id on $entityTable (id); ''',
''',
); );
} }
@ -111,6 +111,8 @@ class AuthenticatorDB {
await db.update( await db.update(
entityTable, entityTable,
localAuthEntity.toMap(), localAuthEntity.toMap(),
where: '_generatedID = ?',
whereArgs: [localAuthEntity.generatedID],
conflictAlgorithm: ConflictAlgorithm.replace, conflictAlgorithm: ConflictAlgorithm.replace,
); );
} }