git-workflow-migration

Creates and applies Prisma database migrations using a one-off Docker container and migrate diff.

1|Updated Jan 14, 2024
One-click install
npx skills add https://github.com/Eyhenij/rt-tools --skill git-workflow-migration-eyhenij
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-workflow-migration
Source: https://github.com/Eyhenij/rt-tools/tree/main/.claude/skills/git-workflow-migration
Command: npx skills add https://github.com/Eyhenij/rt-tools --skill git-workflow-migration-eyhenij

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Editing prisma/schema.prisma and creating migration files safely is error-prone: prisma migrate dev offers to reset the local database, migration ordering breaks on fresh applies, and removed CLI flags cause silent failures. This Skill provides ready-made commands to generate, verify, and apply migrations without touching the local or production database. ## Core Features & Use Cases - Shadow schema check: Runs npm run check:schema against a shadow database to verify migrations match the schema before merge. - One-off container workflow: Spins up a disposable postgres:16-alpine Docker container to apply the migration chain and diff it against the schema. - Migration file generation: Writes migration.sql via prisma migrate diff --script instead of prisma migrate dev, protecting local data. - Rename recovery: Fixes renamed migrations with prisma migrate resolve --applied when apply fails on existing relations. - Use Case: After editing prisma/schema.prisma to add a bookings table, run the container chain to generate the migration file, verify it with the shadow check, and apply it locally with prisma migrate deploy. ## Quick Start Ask the assistant to create a Prisma migration for the current schema changes using the one-off Docker container workflow and verify it with the schema check.

Frequently Asked Questions about git-workflow-migration

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

FAQPage Schema
How do I create a Prisma migration without prisma migrate dev?

Apply the existing migration chain to a one-off Docker Postgres container, then run prisma migrate diff --from-config-datasource --to-schema prisma/schema.prisma --script and redirect the output into a new migration directory's migration.sql file.

How to verify Prisma migrations match the schema before merging?

Run npm run check:schema, which applies the migration chain to a shadow database suffixed _gate_shadow, diffs it against the schema, and tears it down. It skips silently when Docker is stopped or the address points to production.

Why does prisma migrate deploy fail with relation already exists?

This happens when a migration was renamed: the old name stays recorded as applied in the database. Fix the state with npx prisma migrate resolve --applied <new name>, then re-run the deploy.

Why does prisma migrate diff reject flags like --from-url or --to-url?

Those flags were removed in current Prisma versions, along with --shadow-database-url and --to-schema-datamodel. Check prisma migrate diff --help for the current flag set instead of relying on older web examples.

When should I avoid running prisma migrate dev locally?

Avoid it whenever the local database holds real data, because migrate dev resolves state divergence by offering a database reset. Generate the migration file with migrate diff against a disposable container instead.