Update mautrix-python to use SQLAlchemy for matrix-nio state storage

This commit is contained in:
Tulir Asokan
2020-03-31 22:19:43 +03:00
parent a00c58e521
commit c1d4e8e482
3 changed files with 79 additions and 1 deletions
+7
View File
@@ -24,6 +24,11 @@ from .puppet import Puppet
from .telegram_file import TelegramFile
from .user import User, UserPortal, Contact
try:
from mautrix.bridge.db.nio_state_store import init as init_nio_db
except ImportError:
init_nio_db = None
def init(db_engine: Engine) -> None:
for table in (Portal, Message, User, Contact, UserPortal, Puppet, TelegramFile, UserProfile,
@@ -32,3 +37,5 @@ def init(db_engine: Engine) -> None:
table.t = table.__table__
table.c = table.t.c
table.column_names = table.c.keys()
if init_nio_db:
init_nio_db(db_engine)