migrate

Generate and apply Drizzle PostgreSQL migrations from schema changes.

Updated May 23, 2026
One-click install
npx skills add https://github.com/devturco/thiago-dev-template --skill migrate-devturco
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrate
Source: https://github.com/devturco/thiago-dev-template/tree/main/.claude/skills/migrate
Command: npx skills add https://github.com/devturco/thiago-dev-template --skill migrate-devturco

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Keeps your database schema changes consistent and reliable by turning model/schema edits into real, versioned migrations you can safely run.

Core Features & Use Cases

  • Creates migrations from your current schema: Generates the required migration using your Drizzle setup and current src/server/db/schema.ts.
  • Applies migrations and verifies correctness: Runs generation, reviews the produced SQL, applies it, and finishes with typechecking to catch mismatches early.
  • Cascades updates to dependent layers: Updates Zod validators in src/lib/validators/ and refreshes tRPC routers when API surface is affected, including special handling for better-auth plugin tables.

Quick Start

Create a new migration for adding a table and updating the related relations by running: migrate and paste your schema change description.

Frequently Asked Questions about migrate

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

FAQPage Schema
How do I generate and apply database migrations from schema changes in Drizzle ORM?

To generate database migrations from schema changes, update src/server/db/schema.ts, run bun db:generate, review the SQL in the drizzle/ folder, apply it via bun db:migrate, and finish with bun typecheck to catch mismatches.

Do I need to manually update Zod validators when changing my PostgreSQL database schema?

You do not need to manually update Zod validators when changing your PostgreSQL schema. The migration process cascades updates to Zod validators in src/lib/validators/ and refreshes tRPC routers automatically.

What is the safest way to handle PostgreSQL table and column changes in a tRPC stack?

The safest way to handle PostgreSQL schema changes is using versioned migrations generated from your Drizzle setup, which prevents manual database updates and verifies correctness through typechecking after applying the SQL.

Does this database migration approach support better-auth plugin tables?

Yes, the database migration approach includes special handling for better-auth plugin tables when cascading schema updates to dependent API layers and refreshing tRPC routers.

Why should I use generated SQL migrations instead of manual database updates?

You should use generated SQL migrations instead of manual database updates to keep schema changes consistent and reliable, turning model edits into versioned migrations that prevent error-prone manual updates and catch type mismatches early.

What should I check if my database migration causes typecheck errors in my tRPC routers?

If your database migration causes typecheck errors, review the generated SQL in the drizzle/ output folder and ensure your tRPC routers and Zod validators were properly updated to reflect the schema changes before running bun typecheck.