{
  "id": 22147013,
  "title": "Roll back a bad migration: code and database together",
  "url": "https://urgent.news/2026/11/27/roll-back-a-bad-migration-code-and-database-together",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-27T10:30:00.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/hpoyrazk/roll-back-a-bad-migration-code-and-database-together-5c7a"
  },
  "original_language": "en",
  "account": "When rolling back a bad migration, both the code and the database must be restored. Most platforms only restore the code, while the database requires manual intervention. Gregale simplifies this process with a single command, gregale rollback --restore-databases, which restores the managed PostgreSQL database to the state before the migration and moves the app to the restored database simultaneously. The original database with all its data remains untouched.\n\nRolling back only the code can lead to issues if the migration dropped or renamed a column, changed data types, or modified data. To avoid this, Gregale verifies that rolling back to a release older than the migration is not possible unless the user acknowledges it.\n\nAn automatic rollback never goes further back than the migration. If undoing a failing release would expose users to older code, Gregale notifies you so you can choose between fixing the issue or restoring the database.\n\nTo perform a rollback, run gregale rollback my-api --to v41 --restore-databases. Gregale names the migrations it undoes and the restore point, guides you through the process step-by-step, and handles any failures gracefully. Writes after the restore point are preserved in the original database, allowing you to manually compare and move data if necessary. A short outage is expected during the switch, typically under a minute.",
  "summary": "Originally published on gregale.dev . I build Gregale, so read this as a vendor's page. Competitor details come from each vendor's own docs, linked in the post. This post was written with AI assistance. To undo a bad migration, you have to roll back two things: the code and the database. Most platforms roll back only the code; the database is a separate service with its own backups, and putting…",
  "key_points": [
    "Gregale simplifies rollback of bad migrations with single command",
    "Database restored to state before migration, app moved simultaneously",
    "Original database remains untouched, writes preserved after restore point"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}