Files
The-transit-Project/.github/agents/azure-debug-generate/references/migrations.md
T
Sven laptop 635a130f0b
Build and Push Docker Images / detect-changes (push) Successful in 11s
Build and Push Docker Images / build-auth-api (push) Successful in 1m0s
Build and Push Docker Images / build-employee-api (push) Successful in 1m2s
Build and Push Docker Images / build-transit-api (push) Successful in 1m1s
Build and Push Docker Images / build-error-log-api (push) Successful in 1m5s
Build and Push Docker Images / build-admin-ui (push) Successful in 1m13s
Build and Push Docker Images / build-monitoring-ui (push) Successful in 1m15s
Build and Push Docker Images / deploy-test-node (push) Successful in 3s
──────
### Summary of Changes
  1. Documentation Consolidation:
      • Relocated the docs/ folder and all repository .md files (README.md, DEPLOYMENT.md, DOCKER_README.md,
      DOMAINS_README.md, GETTING_STARTED.md, CI_CD_PORTAINER_GUIDE.md, ADMIN_DEPLOYMENT_SUMMARY.md,
      SECURITY_PRIVATE_FILES.md, handoff.md, azure-project-plan.md, plus service-specific READMEs) into .
      • Updated document links in README.md.
  2. AI Agent Project Map:
      • Created PROJECT_MAP.md in the project root containing complete architecture diagrams, service specs, ports, DB
      schemas, environment variables, and developer workflows.
      • Added PROJECT_MAP.md to .gitignore.
  3. Monitoring UI & Infrastructure Integration:
      • Added monitoring_ui service to docker-compose.yml (port 5175).
      • Configured Gitea workflow docker-build.yml for monitoring_ui builds.
      • Added CORS middleware headers in index.js.
      • Added nginx.conf copy step in Dockerfile.

  ──────
  ### Recommended Commit Message

    docs: consolidate project documentation into monitoring_ui and add agent project map

    - Move all markdown documentation files and docs/ folder into monitoring_ui/docs/
    - Update documentation hub index (monitoring_ui/docs/README.md) with relative paths
    - Generate comprehensive AI agent reference map (PROJECT_MAP.md) in repository root
    - Add PROJECT_MAP.md and monitoring_ui build output/env overrides to .gitignore
    - Integrate monitoring_ui service into docker-compose.yml and Gitea CI workflow
    - Configure CORS handling in employee_api for monitoring dashboard access
    ──────
  ### Alternative Short Commit Message

    refactor(docs): move docs to monitoring_ui and create AI agent PROJECT_MAP.md
2026-09-20 23:33:55 +02:00

5.2 KiB

Important: This skill provides guidance and recommended instructions to assist the AI system. Outputs are not guaranteed to be complete, correct, secure, or applicable to every scenario. Results should be reviewed and validated by a human before being applied. The AI model may choose not to follow all instructions exactly, and additional verification may be required.

Database Migrations — Generation

Generate compose migration services from the plan's Migrations table. The plan records WHAT migration tool is in use and which service needs it. This reference covers HOW to generate the compose configuration.

The migration service is ordinary compose content and is identical for Docker or Podman. Any task or command that drives it (docker compose up db-migrate) uses the plan's Orchestrator Compose Command — substitute podman compose when the plan selected Podman.


Targeted Resolution

The plan's Migrations table provides: Generate | Service | Migration Tool. Before generating the docker-compose migration service, perform targeted resolution to fill in the details:

Detail How to Resolve
Migration directory Scan for tool-specific directories: prisma/migrations/, migrations/, Migrations/, alembic/
Migration command Check the project's script runner (e.g., package.json scripts) for an existing migration command. If found, use it. If not, construct from the tool name.
Target database service Match against the plan's Emulators table — the database emulator's compose service name
Connection env var Check local.settings.json, .env, or the migration tool's config file for the variable name
Compose-network connection string Same shape as the local connection string but with the compose service name as host instead of localhost
Existing script Check whether a migration script already exists in the project's script runner

Migration Script Lookup

Detection Evidence Instruction
Existing migration script in project (e.g., npm run db:migrate) Use it as-is in the docker-compose service
Migration tool detected but no script Create a script in the project's native script runner that wraps the tool's CLI command (e.g., "db:migrate": "npx prisma migrate deploy" in package.json)
Raw SQL files only, no migration tool Recommend and install a lightweight migration tool as a dev dependency (e.g., node-pg-migrate for Node.js). Ask the user before installing.

Docker Compose Patterns

Two patterns are needed: a healthcheck on the database service and a one-shot migration service.

Healthcheck Pattern

When migrations are present, the target database service must have a healthcheck so the migration service can use depends_on with condition: service_healthy. The healthcheck definition belongs in the emulator's docker-compose config — see the emulator reference files in emulators/.

Migration Service Pattern

services:
  db-migrate:
    image: ${RUNTIME_IMAGE}
    working_dir: /app
    depends_on:
      ${DATABASE_SERVICE}:
        condition: service_healthy
    volumes:
      - ./:/app:ro
      ${EXTRA_VOLUME_MOUNTS}
    environment:
      ${CONNECTION_ENV_VAR}: ${CONNECTION_STRING_FOR_COMPOSE_NETWORK}
    entrypoint: ${MIGRATION_SCRIPT}
    restart: "no"

Filling in the template — use resolved details:

Placeholder How to determine
RUNTIME_IMAGE A Docker image that provides the language runtime. See the table below.
DATABASE_SERVICE The compose service name for the target database (from Emulators table)
CONNECTION_ENV_VAR The environment variable the migration tool expects (from targeted resolution)
CONNECTION_STRING_FOR_COMPOSE_NETWORK Same shape as local connection string but with compose service name as host
EXTRA_VOLUME_MOUNTS Additional mounts needed for the ecosystem. See the table below.
MIGRATION_SCRIPT The project's migration script command (from targeted resolution)

Runtime images and extra volume mounts:

Ecosystem Image Extra Volume Mounts Notes
Node.js / TypeScript node:{major}-slim ./node_modules:/app/node_modules:ro Mount node_modules separately for native modules
.NET mcr.microsoft.com/dotnet/sdk:{version} — Best-effort — emit limited support warning
Python python:{version}-slim ./.venv:/app/.venv:ro (if applicable) Best-effort — emit limited support warning
Java eclipse-temurin:{version} — Best-effort — emit limited support warning
Go golang:{version} — Best-effort — emit limited support warning

Key properties:

  • depends_on with condition: service_healthy — waits for the database to accept connections
  • volumes with :ro — mounts project files read-only for safety
  • restart: "no" — runs once per docker compose up, does not restart after exit
  • Mount ecosystem-specific dependency directories when the migration tool is installed as a project dependency