Skip to Content
Skillsdatabase-migration

database-migration

Generate database migrations with complete rollback logic and mandatory verification, for safe schema changes.

Triggers

Natural-language phrases that auto-invoke the skill:

  • “create migration”
  • “add table”
  • “modify schema”
  • “change database”
  • “add column to [table]”
  • “rename [table/column]“

What it does

  • Queries the knowledge graph for past database pitfalls, decisions, and patterns before anything else (Phase 0) — migrations repeat the same mistakes
  • Detects the migration framework (Knex, Prisma, TypeORM, Drizzle, or raw SQL) and its directory and naming conventions
  • Runs a mandatory ToM verification checkpoint — never skipped, since migrations affect production data
  • Generates a timestamped migration file with both UP (apply) and DOWN (rollback) for every change
  • Runs safety checks: NOT NULL without DEFAULT, dropping columns with data, UNIQUE on possible duplicates, table-locking alterations
  • Shows run and rollback commands for the detected framework, then emits an execution summary into the knowledge graph (always recording pitfalls avoided)

Example

"add a verified_at column to the users table"

Produces a timestamped migration with the UP add-column and a matching DOWN drop-column, after confirming the schema change and flagging any data-loss risk.

  • Theory of Mind — the mandatory verification checkpoint for high-stakes database changes
  • Knowledge Graph — where migration pitfalls and schema decisions persist across sessions