feat: complete pragativeer v2 frontend and backend, docker setup, and cbt engine
This commit is contained in:
17
backend/database.py
Normal file
17
backend/database.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import os
|
||||
from sqlmodel import create_engine, SQLModel, Session
|
||||
from typing import Generator
|
||||
|
||||
DATABASE_URL = os.getenv("DATABASE_URL", "postgresql://pragativeer_admin:local_secure_password_2026@postgres:5432/pragativeer_prod")
|
||||
|
||||
# Using the standard SQLModel engine config for PostgreSQL
|
||||
engine = create_engine(DATABASE_URL, echo=True)
|
||||
|
||||
def init_db():
|
||||
# Automatically generates tables based on the classes imported from models.py
|
||||
import models
|
||||
SQLModel.metadata.create_all(engine)
|
||||
|
||||
def get_session() -> Generator[Session, None, None]:
|
||||
with Session(engine) as session:
|
||||
yield session
|
||||
Reference in New Issue
Block a user