Add psycopg2 as an optional dependency and throw error at startup if db is not initialized
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
from sqlalchemy.engine.base import Engine
|
||||
|
||||
from mautrix.bridge.db import UserProfile, RoomState
|
||||
|
||||
from .bot_chat import BotChat
|
||||
@@ -23,7 +25,7 @@ from .telegram_file import TelegramFile
|
||||
from .user import User, UserPortal, Contact
|
||||
|
||||
|
||||
def init(db_engine) -> None:
|
||||
def init(db_engine: Engine) -> None:
|
||||
for table in (Portal, Message, User, Contact, UserPortal, Puppet, TelegramFile, UserProfile,
|
||||
RoomState, BotChat):
|
||||
table.db = db_engine
|
||||
|
||||
Reference in New Issue
Block a user