rodrigobranas/formacao_ia_arq_t1_3/drizzle-safe-migrations

Claude Code and agent skill by rodrigobranas/formacao_ia_arq_t1_3

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Production-safe Drizzle migration workflow for schema changes that require data backfills or constraint tightening. Use when changing enums/check constraints/defaults, removing status values, or sequencing custom and generated migrations in Drizzle. Trigger on requests about Drizzle migration safety, deployment-safe backfills, migration ordering, and rollback planning.

Install

npx vskill@latest install rodrigobranas/formacao_ia_arq_t1_3/drizzle-safe-migrations

SKILL.md

The same SKILL.md was published earlier as renatoroessler/painel-clima/drizzle-safe-migrations.

Drizzle Safe Migrations

Overview

Use this skill to run database migrations in a way that is auditable, deployment-safe, and consistent with Drizzle's migration model.

Core Rules

  • Always generate schema migrations with the project script (bun run db:generate).
  • Never hand-edit generated schema migration files.
  • Generate data backfills as custom migrations (bun run db:generate -- --custom --name <name>) and edit only that custom SQL file.
  • Apply data normalization before tightening constraints.
  • Keep one-off data fixes in migration history, not as hidden runtime logic, unless an emergency hotfix requires temporary mitigation.

Workflow

  1. Classify the change:
  • schema-only: only column/table/index/default changes.
  • data+schema: old rows must be transformed before new constraints/defaults.
  1. For data+schema, create custom migration first:
  • bun run db:generate -- --custom --name <descriptive_name>
  • Add idempotent backfill SQL.
  1. Generate schema migration second:
  • bun run db:generate
  1. Verify migration ordering in drizzle/meta/_journal.json:
  • backfill migration index must be lower than constraint-tightening migration index.
  1. Verify generated SQL and snapshots:
  • backfill migration contains only intended data change.
  • schema migration contains constraint/default/type changes.
  1. Run full backend verification:
  • bun run lint && bun run typecheck && bun run test
  1. Document deployment notes:
  • expected data transformations,
  • lock-risk areas,
  • rollback strategy.

Backfill Requirements

  • Use restrictive WHERE clauses.
  • Prefer idempotent updates (UPDATE ... WHERE status = 'legacy_value').
  • Do not mix unrelated DDL/DML in the same migration.
  • Keep SQL explicit and minimal.

Constraint Tightening Pattern

When removing allowed values (enum/check):

  1. Backfill existing rows to valid target value.
  2. Update default to new value.
  3. Tighten check/enum constraint.

For large tables or strict uptime targets, use staged PostgreSQL patterns (NOT VALID + VALIDATE CONSTRAINT) where applicable.

Anti-Patterns

  • Hand-editing generated schema migration files.
  • Tightening constraints before backfilling existing data.
  • Hiding one-time migration logic in app startup code without migration artifacts.
  • Running migrations without validating order in the Drizzle journal.

Reference

  • See references/production-playbook.md for command templates and review checklists.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
1
7-day trend score
8

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/rodrigobranas/formacao_ia_arq_t1_3/drizzle-safe-migrations/badge)](https://verified-skill.com/skills/rodrigobranas/formacao_ia_arq_t1_3/drizzle-safe-migrations)

Something wrong with this skill or its page? Tell us.