tablenames-fix-2
This commit is contained in:
parent
4722bc2300
commit
e0a13423cc
18
main.py
18
main.py
|
@ -6,18 +6,13 @@ from sentry_sdk.integrations.aiohttp import AioHttpIntegration
|
|||
from sentry_sdk.integrations.redis import RedisIntegration
|
||||
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
|
||||
from sentry_sdk.integrations.strawberry import StrawberryIntegration
|
||||
from sqlalchemy import inspect
|
||||
from sqlalchemy.engine.create import create_engine
|
||||
from starlette.applications import Starlette
|
||||
from strawberry.asgi import GraphQL
|
||||
from orm.notification import NotificationSeen
|
||||
|
||||
from resolvers.listener import notifications_worker
|
||||
from resolvers.model import Notification
|
||||
from resolvers.schema import schema
|
||||
from services.db import Base
|
||||
from services.rediscache import redis
|
||||
from settings import DB_URL, DEV_SERVER_PID_FILE_NAME, MODE, SENTRY_DSN
|
||||
from settings import DEV_SERVER_PID_FILE_NAME, MODE, SENTRY_DSN
|
||||
import logging
|
||||
|
||||
|
||||
|
@ -29,17 +24,6 @@ logger.setLevel(logging.DEBUG)
|
|||
async def start_up():
|
||||
await redis.connect()
|
||||
|
||||
engine = create_engine(DB_URL)
|
||||
|
||||
# Check if the table already exists
|
||||
inspector = inspect(engine)
|
||||
if not inspector.has_table("notification"):
|
||||
# Create the Notification table
|
||||
Base.metadata.create_all(bind=engine, tables=["notification", "notification_seen"])
|
||||
logger.info("Notification table was created.")
|
||||
else:
|
||||
logger.info("Notification table already exists.")
|
||||
|
||||
task = asyncio.create_task(notifications_worker())
|
||||
logger.info(task)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user