database-migration
创建迁移以添加、删除或编辑数据库中的列、表或索引
📖 中文导读:创建迁移以添加、删除或编辑数据库中的列、表或索引 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。
name: database-migration description: Create 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
- Run
npm run migrate:make name-of-migrationin the shell, wherename-of-migrationis the name of the migration - Open this file and you will find a blank Knex migration
- Search in
migrations/models/examplesfor existing examples of what you are trying to do, and use this as a template for your migration - Fill the migration file in with your changes