feat: add alembic migrations, integration tests, and CI support
- Add alembic dependency and initialize migration framework - Configure async alembic env.py for SQLAlchemy 2.0 - Create initial migration for PostORM table - Gate init_db() with SKIP_INIT_DB env var for CI/production - Add PostgreSQL service to Woodpecker CI pipeline - Create integration tests for migrations (TC-INT-001..002) - Create integration tests for SQLAlchemyPostRepository (TC-INT-003..009) - Add unit test for init_db skip behavior (TC-UNIT-901) - All 176 tests pass, coverage 72.59%
This commit is contained in:
@@ -78,7 +78,13 @@ async def init_db() -> None:
|
||||
|
||||
Creates all tables defined in the metadata.
|
||||
Should be called on application startup.
|
||||
Skipped in CI/production where alembic manages schema.
|
||||
"""
|
||||
import os
|
||||
|
||||
if os.environ.get("SKIP_INIT_DB", "").lower() in ("1", "true", "yes"):
|
||||
return
|
||||
|
||||
from app.infrastructure.database.models import Base
|
||||
|
||||
async with engine.begin() as conn:
|
||||
|
||||
Reference in New Issue
Block a user