database-migration
Tools to manage database schema changes with TypeORM.
Install
mkdir -p .claude/skills/database-migration-xiangteng007 && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/15740" && unzip -o skill.zip -d .claude/skills/database-migration-xiangteng007 && rm skill.zipInstalls to .claude/skills/database-migration-xiangteng007
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
創建和執行 TypeORM 資料庫遷移,管理 schema 變更Key capabilities
- →Automatically generate TypeORM migrations from entity changes
- →Manually create blank migration files
- →Run all pending database migrations
- →Revert the last executed migration
- →View the status of database migrations
- →Implement reversible database schema changes
How it works
The skill provides commands to generate, run, revert, and show the status of TypeORM database migrations. It supports both automatic generation from entity changes and manual creation of migration files.
Inputs & outputs
When to use database-migration
- →Generate migration from entity changes
- →Run pending database migrations
- →Revert a failed migration
About this skill
Database Migration Skill
管理 TypeORM 資料庫遷移。
創建遷移
自動生成(從 Entity 變更)
cd backend
npm run migration:generate -- src/migrations/DescriptiveName
手動創建空白遷移
cd backend
npm run migration:create -- src/migrations/DescriptiveName
執行遷移
運行所有待執行遷移
npm run migration:run
回滾上一次遷移
npm run migration:revert
查看遷移狀態
npm run migration:show
遷移檔案結構
import { MigrationInterface, QueryRunner } from 'typeorm';
export class DescriptiveName1234567890 implements MigrationInterface {
name = 'DescriptiveName1234567890';
public async up(queryRunner: QueryRunner): Promise<void> {
// 升級操作
await queryRunner.query(`ALTER TABLE ...`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
// 回滾操作
await queryRunner.query(`ALTER TABLE ...`);
}
}
最佳實踐
- 命名規範: 使用描述性名稱,如
AddUserEmailIndex - 原子性: 每個遷移只做一件事
- 可回滾: 確保
down()方法正確實作 - 測試: 在開發環境先測試遷移
- 備份: 生產環境執行前先備份資料庫
When not to use it
- →When using a different ORM or database migration tool
- →When direct SQL schema changes are preferred
- →When the database schema is static and does not require versioning
Limitations
- →Specific to TypeORM database migrations
- →Requires manual implementation of the down() method for reversibility
- →Best practices recommend testing migrations in a development environment first
How it compares
This skill offers a structured approach to managing TypeORM database schema changes through versioned migrations, ensuring atomic and reversible updates, unlike manual SQL script execution.
Compared to similar skills
database-migration side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| database-migration (this skill) | 0 | 7mo | Review | Beginner |
| drizzle-orm | 32 | 2mo | No flags | Intermediate |
| backend-dev | 1 | 6mo | No flags | Intermediate |
| prisma-database | 0 | 6mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by xiangteng007
View all by xiangteng007 →You might also like
drizzle-orm
EpicenterHQ
Drizzle ORM patterns for type branding and custom types. Use when working with Drizzle column definitions, branded types, or custom type conversions.
backend-dev
marmelab
Coding practices for backend development in Atomic CRM. Use when deciding whether backend logic is needed, or when creating/modifying database migrations, views, triggers, RLS policies, edge functions, or custom dataProvider methods that call Supabase APIs.
prisma-database
slashwhy
Prisma schema conventions, migrations, seeding, and query patterns. Use when modifying database schema, creating migrations, or writing complex queries.
ck:databases
lengo0951
Design schemas, write queries for MongoDB and PostgreSQL. Use for database design, SQL/NoSQL queries, aggregation pipelines, indexes, migrations, replication, performance optimization, psql CLI.
event-store-design
wshobson
Design and implement event stores for event-sourced systems. Use when building event sourcing infrastructure, choosing event store technologies, or implementing event persistence patterns.
springboot-patterns
affaan-m
Spring Boot 架构模式、REST API 设计、分层服务、数据访问、缓存、异步处理和日志记录。适用于 Java Spring Boot 后端工作。