Skip to main content

Runbook: Database Migration

Purpose

Apply database schema migrations with minimal risk to production data.

Prerequisites

  • SSH access to odin
  • Migration command for the service (see service docs)
  • Recent database backup

Procedure

Step 1: Create a backup

# Use the standard backup runbook
# (or run a manual pg_dump if needed)

Step 2: Stop write-heavy services

ssh ravenhelm@100.115.101.81 "docker stop <service>"

Step 3: Run migrations

Run the service's migration command inside its container or job:

ssh ravenhelm@100.115.101.81 "docker exec -it <service> <migration-command>"

Step 4: Restart services

ssh ravenhelm@100.115.101.81 "docker start <service>"

Verification

  • Confirm the service starts cleanly
  • Verify critical queries or endpoints

Rollback

If the migration fails, restore from the most recent backup and document the failure.