From 0b0bf8a673b2452019a3ea75d66bd07a6e4c3ce8 Mon Sep 17 00:00:00 2001 From: Mo Balaa Date: Wed, 31 May 2023 23:29:51 -0500 Subject: [PATCH] Fixes to get working out of the box --- src/gptbot/classes/bot.py | 3 ++- src/gptbot/migrations/__init__.py | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gptbot/classes/bot.py b/src/gptbot/classes/bot.py index 4c0b442..5e7c271 100644 --- a/src/gptbot/classes/bot.py +++ b/src/gptbot/classes/bot.py @@ -699,7 +699,8 @@ class GPTBot: self.matrix_client.store = matrix_store( self.matrix_client.user_id, self.matrix_client.device_id, - self.crypto_store_path or "", + '.', #store path + database_name=self.crypto_store_path or "", ) self.matrix_client.olm = Olm( diff --git a/src/gptbot/migrations/__init__.py b/src/gptbot/migrations/__init__.py index 1085ee2..ae2be21 100644 --- a/src/gptbot/migrations/__init__.py +++ b/src/gptbot/migrations/__init__.py @@ -2,7 +2,8 @@ from collections import OrderedDict from typing import Optional from importlib import import_module -from duckdb import DuckDBPyConnection +from peewee import SqliteDatabase + MAX_MIGRATION = 8 @@ -11,7 +12,7 @@ MIGRATIONS = OrderedDict() for i in range(1, MAX_MIGRATION + 1): MIGRATIONS[i] = import_module(f".migration_{i}", __package__).migration -def get_version(db: DuckDBPyConnection) -> int: +def get_version(db: SqliteDatabase) -> int: """Get the current database version. Args: @@ -26,7 +27,7 @@ def get_version(db: DuckDBPyConnection) -> int: except: return 0 -def migrate(db: DuckDBPyConnection, from_version: Optional[int] = None, to_version: Optional[int] = None) -> None: +def migrate(db: SqliteDatabase, from_version: Optional[int] = None, to_version: Optional[int] = None) -> None: """Migrate the database to a specific version. Args: