Skip to content

UC-PLT-402: Automated CI/CD & Schema Migration

1. Metadata

Property Value
ID UC-PLT-402
Actor Software Engineer / System
Trigger Git Push to production branch
Pre-conditions All tests passed in Staging; Approval received from Lead
Post-conditions Code deployed to Edge; DB Schema updated; Cache invalidated
Side Effects Short-term lock on specific DB tables during migration (< 500ms)

2. Description

Streamlines the deployment process, ensuring that new features and security patches are released with zero manual intervention and no database synchronization errors.

3. Success Scenario

  1. Push: Developer merges a 'Feature' branch into main.
  2. Build: GitHub Actions triggers a build process, transpiling TypeScript and minifying assets.
  3. Testing: System executes 250+ unit tests and 50+ E2E integration tests.
  4. Schema Update:
    • System detects a new SQL migration file.
    • Atlas or Flyway executes the migration against the Production database.
  5. Deployment:
    • Compiled Worker code is pushed to Cloudflare Pages/Workers.
    • Assets are propagated to the global CDN.
  6. Verification: Automated 'Smoke Tests' run against the live endpoint.
  7. Cleanup: Old build artifacts are archived.

4. Acceptance Criteria

  • [ ] Rollback: Every deployment must be revertible to the previous stable state with a single click in < 30 seconds.
  • [ ] Safety: Database migrations must be 'Backward Compatible' (No destructive DROP COLUMN without multi-phase planning).
  • [ ] Speed: Total pipeline duration (Build to Live) must be < 5 minutes.

5. Deployment Pipeline

sequenceDiagram participant Dev as Developer participant Git as Git Repo participant CI as CI/CD Pipeline participant DB as Production DB participant Live as Cloudflare Edge Dev->>Git: Push to main Git->>CI: Trigger Build CI->>CI: Run Tests CI->>DB: Apply SQL Migrations CI->>Live: Deploy Code Live-->>Dev: Success Notification