squash-migrations

Squash branch Drizzle migrations into one migration.sql and snapshot.json pair.

1|1|Updated May 11, 2026
One-click install
npx skills add https://github.com/taxmaxi/taxmaxi --skill squash-migrations-taxmaxi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: squash-migrations
Source: https://github.com/taxmaxi/taxmaxi/tree/main/.agents/skills/squash-migrations
Command: npx skills add https://github.com/taxmaxi/taxmaxi --skill squash-migrations-taxmaxi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Feature branches often accumulate multiple Drizzle migration directories during development, cluttering the schema history and making reviews harder. This Skill consolidates all migrations introduced by the current branch into a single migration.sql and snapshot.json pair before merging, without touching migrations already on main. ## Core Features & Use Cases - Branch Migration Detection: Identifies migration directories added relative to main using git diff and untracked file listing, verifying none exist on main. - Database State Handling: Checks whether branch migrations were applied locally and rebuilds a main-only database by resetting the Docker Compose volume when needed. - Regeneration and Verification: Deletes branch-owned migrations, rebuilds packages with Turbo, regenerates one migration via db:generate, preserves hand-written SQL backfills, and validates with db:migrate and persistence tests. - Use Case: Before merging a PR that added four incremental Drizzle migrations, run this Skill to collapse them into one clean migration directory and confirm the persistence test suite passes. ## Quick Start Use the squash-migrations skill to combine this branch's Drizzle migrations into a single migration and snapshot pair, then verify it against the local database.

Frequently Asked Questions about squash-migrations

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

FAQPage Schema
How do I squash multiple Drizzle migrations into one?▼

Identify migration directories added by your branch relative to main, delete only those directories, rebuild affected packages, then run drizzle-kit generation to produce a single migration.sql and snapshot.json pair. Verify by applying the migration and running persistence tests.

How to clean up branch migrations before merging a pull request?▼

List files added relative to main with git diff, confirm each migration directory is absent from main, remove them, and regenerate one consolidated migration. Never modify or delete migrations that already exist on main.

What happens to hand-written SQL when squashing Drizzle migrations?▼

Drizzle regenerates schema changes but not hand-written data backfills or manual SQL. Inspect every migration before deletion, record custom statements, and restore them in a dependency-safe position inside the single generated migration.sql.

Do I need to reset my local database before squashing migrations?▼

Only if branch migrations were already applied locally. Check the drizzle.__drizzle_migrations table; if any branch migration appears, reset the Docker Compose volume, rebuild the database from main's migrations, then switch back to your branch.

When should I not squash database migrations?▼

Do not squash migrations already present on main, since rewriting shared history breaks other environments. Also stop if the branch has no new migrations, exactly one valid pair already exists, or uncommitted unrelated work blocks branch switching.