database-migration

Generate database migrations with rollback logic for Knex, Prisma, TypeORM, and Drizzle.

232|12|Updated Oct 10, 2025
One-click install
npx skills add https://github.com/qf-studio/navigator --skill database-migration-qf-studio
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-migration
Source: https://github.com/qf-studio/navigator/tree/main/skills/database-migration
Command: npx skills add https://github.com/qf-studio/navigator --skill database-migration-qf-studio

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing database migrations by hand is error-prone: missing rollback logic, unsafe NOT NULL columns, and framework-specific syntax differences can cause failed deployments or data loss. This Skill generates complete, reversible migrations with built-in safety checks. ## Core Features & Use Cases - Framework Detection: Automatically detects Knex, Prisma, TypeORM, or Drizzle from project files and applies the correct migration conventions. - Up/Down Generation: Creates both the schema change (up) and its rollback (down), with warnings for destructive operations like DROP COLUMN. - Safety Validation: Flags common hazards such as NOT NULL columns without defaults, UNIQUE constraints on duplicate data, and large-table alterations. - Use Case: Ask to add an email verification column to the users table, and receive a timestamped Knex migration file with rollback logic, safety warnings, and the exact commands to run and revert it. ## Quick Start Ask the assistant to create a migration that adds a new column or table to your database schema.

Frequently Asked Questions about database-migration

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

FAQPage Schema
How do I create a database migration with rollback?

Describe the schema change you want, such as adding a column or creating a table. The skill detects your migration framework, confirms the planned changes with you, then generates a timestamped migration file containing both up and down functions.

Which migration frameworks are supported: Knex, Prisma, or TypeORM?

Knex, Prisma, TypeORM, and Drizzle are all detected automatically from files like knexfile.js, prisma/schema.prisma, or package.json dependencies. If none is found, you can generate raw SQL migrations or set up a framework first.

Does the migration generator handle Prisma schema changes?

Yes. For Prisma projects it updates prisma/schema.prisma with the new models or fields, then guides you through npx prisma migrate dev with a named migration and client regeneration.

Why does adding a NOT NULL column fail on existing tables?

Existing rows have no value for the new column, so the database rejects the change. The safety check flags this and recommends adding a DEFAULT value or a data migration step before applying the schema change.

Can a migration rollback cause data loss?

Yes. Rolling back an ADD COLUMN runs DROP COLUMN, which permanently deletes that column's data. The skill warns about destructive down operations and suggests backups or deprecation instead of dropping.