feature/migrations, closes #19 #20

Merged
crimsen merged 28 commits from feature/migrations into develop 2023-03-02 05:37:11 +00:00
1 changed files with 2 additions and 2 deletions
Showing only changes of commit 7796f45097 - Show all commits

View File

@ -6,7 +6,7 @@ Used by plugins for setting and notification functionality.
from typing import Union from typing import Union
from flask import current_app from flask import current_app
from werkzeug.exceptions import NotFound, BadRequest from werkzeug.exceptions import NotFound, BadRequest
from sqlalchemy.exc import OperationalError from sqlalchemy.exc import OperationalError, ProgrammingError
from flask_migrate import upgrade as database_upgrade from flask_migrate import upgrade as database_upgrade
from importlib.metadata import entry_points from importlib.metadata import entry_points
@ -43,7 +43,7 @@ def get_enabled_plugins() -> list[Plugin]:
"""Get all installed and enabled plugins""" """Get all installed and enabled plugins"""
try: try:
enabled_plugins = Plugin.query.filter(Plugin.enabled == True).all() enabled_plugins = Plugin.query.filter(Plugin.enabled == True).all()
except OperationalError as e: except (OperationalError, ProgrammingError) as e:
logger.error("Could not connect to database or database not initialized! No plugins enabled!") logger.error("Could not connect to database or database not initialized! No plugins enabled!")
logger.debug("Can not query enabled plugins", exc_info=True) logger.debug("Can not query enabled plugins", exc_info=True)
# Fake load required plugins so the database can at least be installed # Fake load required plugins so the database can at least be installed