← Home ← Codex ← DEBT
Browse by Category
+ added · updated 7d
← Back to glossary

Deployment Rollback Strategies

DevOps PHP 5.0+ Intermediate
debt(d7/e5/b5/t7)
d7 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'only careful code review or runtime testing' (d7). The detection_hints.tools list (Capistrano, Deployer, AWS CodeDeploy) are deployment tools, not analyzers that detect missing rollback procedures. The code_pattern notes 'no documented rollback procedure' and 'migrations without down() method' — these require manual review or runtime discovery during an actual failed deployment. No automated tooling catches missing rollback strategies.

e5 Effort Remediation debt — work required to fix once spotted

Closest to 'touches multiple files / significant refactor in one component' (e5). The quick_fix suggests monthly staging testing, but actually fixing missing rollback capability requires: adding down() methods to all migrations, documenting rollback procedures, potentially restructuring database changes to be reversible (add columns before removing old ones per common_mistakes). This spans migration files, deployment scripts, and documentation — multiple files within the devops/deployment component.

b5 Burden Structural debt — long-term weight of choosing wrong

Closest to 'persistent productivity tax' (b5). Applies_to shows web and cli contexts from PHP 5.0+, meaning this affects all deployment scenarios. Lack of rollback strategy creates ongoing anxiety and slower deployments (teams deploy less frequently when rollback is risky). However, it doesn't define the system's architecture — it's a process/procedure gap that taxes velocity without fundamentally shaping code structure.

t7 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'serious trap' (t7). The misconception field explicitly states 'You can always roll back by reverting the git commit' — this contradicts how developers familiar with git expect rollback to work. Git revert feels like a universal undo, but database schema changes persist independently. Common_mistakes reinforces this: 'code reverted, DB schema already migrated — app breaks with old code on new schema.' This trap catches experienced developers who assume version control solves deployment rollback.

About DEBT scoring →

Also Known As

rollback revert deployment undo deploy

TL;DR

Strategies for reverting a broken deployment quickly — from git revert and re-deploy to instant traffic switching with blue-green or feature flags.

Explanation

Rollback options by speed: Feature flags (instant — flip a flag without deploying), Blue-green (instant — switch load balancer to previous environment), Canary (fast — redirect canary traffic to stable), Git revert + redeploy (minutes — depends on CI/CD pipeline speed), Database rollback (slow, risky — migrations may not be reversible). The fastest rollback is the one already in place before the deploy. Database migrations that are not reversible are the most common rollback blocker — always write forward-compatible migrations first.

Diagram

flowchart TD
    DEPLOY[New Deploy] --> CHECK{Smoke Tests}
    CHECK -->|Pass| LIVE[Live Traffic]
    CHECK -->|Fail| RB1[Instant Rollback<br/>Blue-Green switch]
    LIVE --> MONITOR{Monitoring}
    MONITOR -->|Error spike| RB2[Rollback Options]
    RB2 --> FF[Feature Flag off<br/>instant]
    RB2 --> BG[Blue-Green switch<br/>seconds]
    RB2 --> GR[Git revert + redeploy<br/>minutes]
style LIVE fill:#238636,color:#fff
style FF fill:#238636,color:#fff
style FAIL fill:#f85149,color:#fff
style ALERT fill:#f85149,color:#fff

Common Misconception

You can always roll back by reverting the git commit — database schema changes that have already run cannot be rolled back by reverting code; the schema is still modified.

Why It Matters

A deployment that breaks production needs to be fixed in minutes, not hours — pre-planned rollback strategies are the difference between a 5-minute incident and a 2-hour outage.

Common Mistakes

  • Irreversible database migrations — always add columns before removing old ones; never rename in one step.
  • No rollback testing — rollback procedures that have never been tested will fail when needed most.
  • Assuming git revert is sufficient — code reverted, DB schema already migrated — app breaks with old code on new schema.
  • Rolling back without investigating root cause — rollback buys time; the fix still needs to be understood.

Code Examples

✗ Vulnerable
# Breaking migration with no rollback path:
ALTER TABLE users RENAME COLUMN email TO email_address;
# Old app code: SELECT email FROM users — now broken
# Rolling back the code: still broken, schema changed
# Only fix: another migration or forward-fix deploy
✓ Fixed
# Forward-compatible migration — allows rollback:
# Step 1: Add new column (app still uses old column):
ALTER TABLE users ADD COLUMN email_address VARCHAR(254);
UPDATE users SET email_address = email;

# Step 2: Deploy app reading both columns (backwards compatible)
# Step 3: Deploy app using only new column
# Step 4: Drop old column in a later migration
# Rollback possible at any step except after step 4

Added 15 Mar 2026
Edited 22 Mar 2026
Views 65
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
1 ping T 0 pings W 1 ping T 0 pings F 0 pings S 0 pings S 0 pings M 1 ping T 1 ping W 2 pings T 2 pings F 2 pings S 13 pings S 1 ping M 0 pings T 0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 1 ping M 1 ping T 0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 1 ping M 1 ping T 0 pings W
No pings yet today
PetalBot 1
Scrapy 19 Amazonbot 7 Perplexity 6 Ahrefs 4 ChatGPT 4 SEMrush 4 Google 2 Claude 2 Majestic 1 Bing 1 Meta AI 1 PetalBot 1
crawler 49 crawler_json 3
DEV INTEL Tools & Severity
🟠 High ⚙ Fix effort: Medium
⚡ Quick Fix
Test your rollback procedure in staging monthly — a rollback you've never practiced is a rollback that won't work at 2am during an incident
📦 Applies To
PHP 5.0+ web cli
🔗 Prerequisites
🔍 Detection Hints
No documented rollback procedure; database migrations without down() method; rollback requiring manual steps taking >10 minutes
Auto-detectable: ✗ No capistrano deployer aws-codedeploy
⚠ Related Problems
🤖 AI Agent
Confidence: Low False Positives: Medium ✗ Manual fix Fix: High Context: File


✓ schema.org compliant