fix: delete from namespaced storage when putting...

This commit is contained in:
əlemi 2022-08-25 20:50:43 +02:00
parent aa0e804965
commit 3b7aa42e0b
No known key found for this signature in database
GPG key ID: BBCBFE5D7244634E

View file

@ -38,7 +38,7 @@ class AddonStorage:
def put(self, key:str, val:Any) -> None: def put(self, key:str, val:Any) -> None:
cur = self.db.cursor() cur = self.db.cursor()
cur.execute("DELETE FROM documents WHERE name = ?", (key,)) cur.execute(f"DELETE FROM documents_{self.name} WHERE name = ?", (key,))
cur.execute(f"INSERT INTO documents_{self.name} VALUES (?, ?)", (key, json.dumps(val, default=str),)) cur.execute(f"INSERT INTO documents_{self.name} VALUES (?, ?)", (key, json.dumps(val, default=str),))
self.db.commit() self.db.commit()