feat(backend): setup FastAPI + SQLite + config
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
13
backend/app/database.py
Normal file
13
backend/app/database.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from sqlmodel import SQLModel, create_engine, Session
|
||||
from app.config import DATABASE_URL
|
||||
|
||||
engine = create_engine(DATABASE_URL, connect_args={"check_same_thread": False})
|
||||
|
||||
|
||||
def get_session():
|
||||
with Session(engine) as session:
|
||||
yield session
|
||||
|
||||
|
||||
def create_db_and_tables():
|
||||
SQLModel.metadata.create_all(engine)
|
||||
Reference in New Issue
Block a user