Add psycopg2 as an optional dependency and throw error at startup if db is not initialized
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
# 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 itertools import chain
|
||||
import sys
|
||||
|
||||
from alchemysession import AlchemySessionContainer
|
||||
|
||||
@@ -57,6 +58,10 @@ class TelegramBridge(Bridge):
|
||||
|
||||
def prepare_db(self) -> None:
|
||||
super().prepare_db()
|
||||
if not self.db.has_table("alembic_version"):
|
||||
self.log.critical("alembic_version table not found. "
|
||||
"Did you forget to `alembic upgrade head`?")
|
||||
sys.exit(10)
|
||||
init_db(self.db)
|
||||
self.session_container = AlchemySessionContainer(
|
||||
engine=self.db, table_base=Base, session=False,
|
||||
|
||||
Reference in New Issue
Block a user