chore: PostgreSQL migration compatibility and infrastructure improvements

Database & Migrations:
- Update all Alembic migrations for PostgreSQL compatibility
- Remove SQLite-specific syntax (AUTOINCREMENT, etc.)
- Add database utility helpers for PostgreSQL operations
- Fix services to use PostgreSQL-compatible queries

Documentation:
- Add comprehensive Docker deployment guide
- Add production deployment documentation
- Add infrastructure architecture documentation
- Update database setup guide for PostgreSQL-only
- Expand troubleshooting guide

Architecture & Validation:
- Add migration.yaml rules for SQL compatibility checking
- Enhance validate_architecture.py with migration validation
- Update architecture rules to validate Alembic migrations

Development:
- Fix duplicate install-all target in Makefile
- Add Celery/Redis validation to install.py script
- Add docker-compose.test.yml for CI testing
- Add squash_migrations.py utility script
- Update tests for PostgreSQL compatibility
- Improve test fixtures in conftest.py

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-11 17:52:28 +01:00
parent 2792414395
commit 3614d448e4
45 changed files with 3179 additions and 507 deletions

View File

@@ -38,9 +38,24 @@ ruff:
pytest:
stage: test
image: python:${PYTHON_VERSION}
services:
- name: postgres:15
alias: postgres
variables:
# PostgreSQL service configuration
POSTGRES_DB: wizamart_test
POSTGRES_USER: test_user
POSTGRES_PASSWORD: test_password
# Application database URL for tests
TEST_DATABASE_URL: "postgresql://test_user:test_password@postgres:5432/wizamart_test"
# Skip database validation during import (tests use TEST_DATABASE_URL)
DATABASE_URL: "postgresql://test_user:test_password@postgres:5432/wizamart_test"
before_script:
- pip install uv
- uv sync --frozen
# Wait for PostgreSQL to be ready
- apt-get update && apt-get install -y postgresql-client
- for i in $(seq 1 30); do pg_isready -h postgres -U test_user && break || sleep 1; done
script:
- .venv/bin/python -m pytest tests/ -v --tb=short
coverage: '/TOTAL.*\s+(\d+%)/'
@@ -57,6 +72,9 @@ pytest:
architecture:
stage: test
image: python:${PYTHON_VERSION}
variables:
# Set DATABASE_URL to satisfy validation (not actually used by validator)
DATABASE_URL: "postgresql://dummy:dummy@localhost:5432/dummy"
before_script:
- pip install uv
- uv sync --frozen