This commit is contained in:
@@ -2,11 +2,10 @@ import time
|
||||
from enum import Enum as Enumeration
|
||||
|
||||
from sqlalchemy import JSON, Column, ForeignKey, Integer, String
|
||||
from sqlalchemy.exc import ProgrammingError
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from orm.author import Author
|
||||
from services.db import Base, engine
|
||||
from services.db import Base, create_table_if_not_exists, engine
|
||||
from utils.logger import root_logger as logger
|
||||
|
||||
|
||||
@@ -42,10 +41,5 @@ class Notification(Base):
|
||||
|
||||
seen = relationship(lambda: Author, secondary="notification_seen")
|
||||
|
||||
|
||||
try:
|
||||
Notification.__table__.create(engine)
|
||||
logger.info("Table `notification` was created.")
|
||||
except ProgrammingError:
|
||||
# Handle the exception here, for example by printing a message
|
||||
logger.info("Table `notification` already exists.")
|
||||
# Вызываем функцию создания таблицы
|
||||
create_table_if_not_exists(engine, Notification)
|
||||
|
Reference in New Issue
Block a user