from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import os

# current path + /backend/app/smartbar.db
SQLALCHEMY_DATABASE_URL = os.getenv("DATABASE_URL", "sqlite:///" + os.path.join(os.path.dirname(__file__), "smartbar.db"))

engine = create_engine(
    SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}
)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
