diff options
Diffstat (limited to 'velascobot2/database.py')
| -rw-r--r-- | velascobot2/database.py | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/velascobot2/database.py b/velascobot2/database.py index 720d10c..582495f 100644 --- a/velascobot2/database.py +++ b/velascobot2/database.py @@ -241,23 +241,6 @@ class Database: ) return count - # I made an oopsie when converting the old jsons to sqlite. I will remove this in the next commit - def fix_all_chats(self): - self.merge_and_rename_key('', ' ') - - def merge_and_rename_key(self, old_key: str, new_key: str): - with _SQLiteContextMgr(database=self.db_name) as db: - db.execute(""" - INSERT INTO vocab (chat_id, key, word, count) - SELECT chat_id, ?, word, count - FROM vocab - WHERE key = ? - ON CONFLICT(chat_id, key, word) DO UPDATE SET count = count + excluded.count - """, (new_key, old_key)) - - # delete old key entries - db.execute("DELETE FROM vocab WHERE key = ?", (old_key,)) - def get_all_chats(self) -> list[ChatData]: with _SQLiteContextMgr(database=self.db_name) as db: rows = db.execute("SELECT * FROM chats").fetchall() |
