19 lines
424 B
Python
19 lines
424 B
Python
import os
|
|
|
|
from dotenv import load_dotenv
|
|
from sqlalchemy import create_engine
|
|
from sqlalchemy.orm import sessionmaker
|
|
|
|
from app.infrastructure.database.models import Base
|
|
|
|
load_dotenv()
|
|
|
|
SQLALCHEMY_DATABASE_URL = os.getenv("DATABASE_URL")
|
|
|
|
engine = create_engine(SQLALCHEMY_DATABASE_URL)
|
|
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
|
|
|
|
|
def init_db():
|
|
Base.metadata.create_all(bind=engine)
|