migration-immutability

Enforce immutability of deployed SQL migrations under server/migrations.

49|15|Updated Mar 26, 2026
One-click install
npx skills add https://github.com/block/proto-fleet --skill migration-immutability
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migration-immutability
Source: https://github.com/block/proto-fleet/tree/main/.claude/skills/migration-immutability
Command: npx skills add https://github.com/block/proto-fleet --skill migration-immutability

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Once a migration has been applied in any environment, its content is effectively frozen. Editing an existing deployed migration can cause schema drift across environments and desynchronization between databases.

Core Features & Use Cases

  • Enforces the rule that deployed migrations must not be edited in place; changes must be added as new migrations.
  • Guides developers to create a new migration with a descriptive name and document the rationale for the change.
  • Applies to migrations under server/migrations that have been merged into origin/main and deployed across environments.

Quick Start

Create a new corrective migration and apply it to update the deployed schema.

Frequently Asked Questions about migration-immutability

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does editing a deployed SQL migration cause schema drift?

Editing a deployed SQL migration causes schema drift because environments that already applied the original file retain the old schema state, desynchronizing them from databases that apply the newly edited version. You must create a new migration instead of modifying the existing one in place.

How do I correct a deployed database migration after it has merged into main?

To correct a deployed database migration, create a new migration file with a descriptive name under your migrations directory, document the rationale for the corrective change, and apply it to update the deployed schema across all environments rather than editing the original.

What is the best practice for managing immutable database migrations across environments?

The best practice for managing immutable database migrations is to enforce a rule that deployed migrations must never be edited in place. Any corrective changes must be added as new migration files to prevent drift and maintain database synchronization.

When do I need to enforce migration immutability in my deployment workflow?

You need to enforce migration immutability once a migration file has merged into origin/main and is deployed across multiple environments. At that point, the migration content is effectively frozen and in-place edits will cause desynchronization between databases.

Does golang-migrate support preventing in-place edits to merged migration files?

Migration immutability validation applies to SQL migrations deployed through workflows like golang-migrate. It prevents in-place edits to merged migration files under your migrations directory by requiring new corrective migrations and validating the overall migration workflow.