drizzle-safe-migrations

Plan Drizzle ORM migrations with data backfills and constraint changes.

567|82|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/pedronauck/skills --skill drizzle-safe-migrations
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: drizzle-safe-migrations
Source: https://github.com/pedronauck/skills/tree/main/skills/drizzle-safe-migrations
Command: npx skills add https://github.com/pedronauck/skills --skill drizzle-safe-migrations

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill ensures that database schema changes in Drizzle ORM are applied safely in production, especially when those changes require data backfills or involve tightening constraints, preventing data corruption and downtime.

Core Features & Use Cases

  • Production-Safe Migrations: Guides a workflow for applying Drizzle migrations that minimizes risk during deployment.
  • Data Backfills: Manages the process of updating existing data to comply with new schema rules before constraints are enforced.
  • Constraint Tightening: Safely modifies enums, check constraints, and defaults without data loss.
  • Use Case: You need to change a status enum in your Drizzle schema from ['pending', 'processing', 'completed'] to ['pending', 'processing', 'completed', 'archived']. This skill helps you backfill existing records that might be in a state that would violate a future constraint, and then safely apply the schema change.

Quick Start

Use the drizzle-safe-migrations skill to plan and execute a safe Drizzle migration with backfills and constraint changes.

Frequently Asked Questions about drizzle-safe-migrations

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

FAQPage Schema
How do I safely add a new value to a Drizzle ORM enum without causing production downtime?

Safe Drizzle ORM enum additions require backfilling existing records before tightening constraints. This workflow ensures data normalization precedes constraint enforcement, preventing data corruption and downtime during production database migrations.

What is the best way to backfill data before applying a schema constraint in Drizzle migrations?

Data backfills in Drizzle migrations require updating existing records to comply with new schema rules before enforcing constraints. This process maintains migration history for all data fixes, ensuring production safety when modifying check constraints or defaults.

How do I plan a rollback for production database schema changes using Drizzle ORM?

Rollback planning for Drizzle ORM schema changes involves maintaining a complete migration history for all data fixes. This ensures you can safely reverse production migrations that included data backfills or constraint tightening without losing records.

When do I need to run data backfills during a database migration?

Data backfills are needed during database migration when schema changes require existing records to comply with new rules. You must backfill data before tightening constraints or modifying enums to prevent violations and downtime in production.

Does this Drizzle migration workflow handle constraint tightening without data loss?

Yes, this Drizzle migration workflow handles constraint tightening without data loss by guiding data backfills before enforcement. It safely modifies enums, check constraints, and defaults while maintaining migration history for all data fixes.

Why does my Drizzle migration fail when I tighten a database constraint on existing data?

Drizzle migrations fail when tightening constraints if existing data violates new schema rules. You must backfill records to comply with the updated constraints before applying the schema change to prevent migration errors and downtime.