heady-migration-engine

Apply topologically ordered Postgres schema migrations with zero downtime.

1|Updated Mar 24, 2026
One-click install
npx skills add https://github.com/HeadyAI/heady-context --skill heady-migration-engine
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: heady-migration-engine
Source: https://github.com/HeadyAI/heady-context/tree/main/heady-skills/heady-migration-engine
Command: npx skills add https://github.com/HeadyAI/heady-context --skill heady-migration-engine

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Coordinate and safely apply schema migrations to a Postgres database with zero downtime.

Core Features & Use Cases

  • Deterministic, topologically sorted migrations with dependency resolution.
  • Zero-downtime deployment patterns (expand-contract, blue-green) and safer rollbacks.
  • Neon branch testing and checksum-based drift detection to ensure coherence.
  • Migration history with Ed25519-signed checksums and audit-ready logs.

Quick Start

Run the migration engine against your Postgres database to apply all pending migrations in topological order.

Frequently Asked Questions about heady-migration-engine

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

FAQPage Schema
How do I run zero-downtime Postgres migrations with safe rollbacks?

Zero-downtime Postgres migrations with safe rollbacks are coordinated by applying versioned schema changes using expand-contract patterns, topological ordering, and a reversible up/down API to ensure deployments do not interrupt database availability.

How does topological sorting help apply database migrations safely?

Topological sorting resolves migration dependencies to apply database changes in a deterministic order. This prevents dependency violations during deployment, ensuring every pending migration is applied sequentially without breaking schema coherence.

Can I test Postgres schema migrations on a Neon branch before deploying?

Yes, Neon branch testing validates schema migrations before deployment. The engine checks migrations against a Neon branch and uses checksum-based drift detection to ensure the test schema matches your production database state before applying changes.

How do migration checksums and advisory locks prevent database drift?

Migration checksums generate Ed25519-signed signatures to detect drift, while advisory locks prevent concurrent migration runs. Together, they guarantee that only one deployment process modifies the schema and any unauthorized changes are immediately flagged.

What is the best way to rollback a failed Postgres schema migration?

The best way to rollback a failed Postgres schema migration is using the reversible up/down API, which executes guarded down migrations. The migration history provides audit-ready logs to track exactly which versioned changes are reversed.

Does this migration engine work without external dependencies?

Yes, the migration engine works standalone without external dependencies. It relies entirely on Postgres features like advisory locks and internal logic for topological sorting, requiring only a Postgres database to apply migrations safely.