database-migration

jakewaldrip's avatarfrom jakewaldrip

Create a migration to add, remove, or edit columns, tables, or indexes in the database

⭐3stars🔀0forks📁View on GitHub🕐Updated Jan 7, 2026

When & Why to Use This Skill

This Claude skill automates the creation of database migrations for Postgres environments using Knex and TypeScript. It streamlines schema management by generating precise migration files to add, remove, or modify tables, columns, and indexes, ensuring consistency with existing project patterns and reducing manual coding errors.

Use Cases

  • Feature Development: Rapidly generate migration scripts when introducing new data structures or tables for application features.
  • Database Optimization: Efficiently add or remove indexes to enhance query performance based on database analysis.
  • Schema Refactoring: Safely modify existing database schemas, such as renaming columns or changing data types, while maintaining Knex/TypeScript standards.
  • Standardization: Ensure all team-generated migrations follow the specific project architecture by leveraging local migration templates and examples.
namedatabase-migration
descriptionCreate a migration to add, remove, or edit columns, tables, or indexes in the database

What I do

  • Create database migrations
  • Add or remove columns
  • Add or remove indexes
  • Add or remove tables

When to use me

Use this when you are editing the database in any way. This can include adding, removing, or editing columns, tables, or indexes

Context

We are using Postgres in a typescript backend. The migrations are written in typescript leveraging Knex

Steps

  1. Run npm run migrate:make name-of-migration in the shell, where name-of-migration is the name of the migration
  2. Open this file and you will find a blank Knex migration
  3. Search in migrations/models/examples for existing examples of what you are trying to do, and use this as a template for your migration
  4. Fill the migration file in with your changes