()
| 12 | SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) |
| 13 | |
| 14 | def init_db(): |
| 15 | try: |
| 16 | Base.metadata.create_all(bind=engine) |
| 17 | try: |
| 18 | from app.log_utils import safe_log_gotcha |
| 19 | safe_log_gotcha("[init_db] Database initialized successfully.") |
| 20 | except ImportError: |
| 21 | print("[init_db] Database initialized successfully.") |
| 22 | except Exception as e: |
| 23 | try: |
| 24 | from app.log_utils import safe_log_gotcha |
| 25 | safe_log_gotcha(f"[init_db] Database initialization failed: {e}") |
| 26 | except ImportError: |
| 27 | print(f"[init_db] Database initialization failed: {e}") |
| 28 | raise |
| 29 | |
| 30 | def get_db(): |
| 31 | db = SessionLocal() |
no test coverage detected