본문으로 건너뛰기
Skillpedia
데이터베이스48k · #4332

database-migration

하는 일

이 도구는 데이터베이스 변경을 관리하도록 돕습니다. 데이터베이스 관리 시스템(ORM)을 바꾸는 경우나 서비스 중단 없이 업데이트해야 할 때도 데이터베이스 구조와 데이터를 안전하게 수정할 수 있게 합니다.

사용하는 경우

  • ✓한 데이터베이스 시스템에서 다른 시스템으로 바꿔야 할 때.
  • ✓데이터베이스 구조(테이블이나 열 추가, 삭제, 수정)를 업데이트할 때.
  • ✓데이터베이스 사이에서 데이터를 옮기거나 변환할 때.

스킬 링크

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/database-migration/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/database-migration/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“Sequelize에서 TypeORM으로 데이터베이스를 옮기려고 합니다. 데이터가 정확하게 전송되고 서비스가 중단되지 않도록 하려면 어떻게 해야 할까요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 도구는 데이터베이스를 변경하는 스크립트를 만드는 과정을 안내합니다. 또한 문제가 생기면 변경을 되돌리는 전략과, 서비스 중단 없이 업데이트하는 방법도 제공합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Supporting material availability

This catalog copy contains the inline guidance below, but does not include the following supporting paths. They are external prerequisites, not bundled files:

  • <support-root>/references/orm-switching.md
  • <support-root>/references/schema-migration.md
  • <support-root>/references/data-transformation.md
  • <support-root>/references/rollback-strategies.md
  • <support-root>/assets/schema-migration-template.sql
  • <support-root>/assets/data-migration-script.py
  • <support-root>/scripts/test-migration.sh

Ask for the original supporting material or an existing installation before using a step that depends on these paths; this catalog does not identify a verified download source for them. Resolve each path relative to that installation, inspect its contents, and verify any applicable license and execution prerequisites. Do not run a command or claim a referenced procedure was followed until its required file exists. Do not fabricate the missing scripts or treat an unrelated file with the same name as equivalent. Independent steps fully documented here can proceed within the user’s authorized scope; report any dependent step as unavailable.

Database Migration

Master database schema and data migrations across ORMs (Sequelize, TypeORM, Prisma), including rollback strategies and zero-downtime deployments.

Do not use this skill when

  • The task is unrelated to database migration
  • You need a different domain or tool outside this scope

Instructions

  • Clarify goals, constraints, and required inputs.
  • Apply relevant best practices and validate outcomes.
  • Provide actionable steps and verification.

Use this skill when

  • Migrating between different ORMs
  • Performing schema transformations
  • Moving data between databases
  • Implementing rollback procedures
  • Zero-downtime deployments
  • Database version upgrades
  • Data model refactoring

ORM Migrations

Sequelize Migrations

// migrations/20231201-create-users.js
module.exports = {
  up: async (queryInterface, Sequelize) => {
    await queryInterface.createTable('users', {
      id: {
        type: Sequelize.INTEGER,
        primaryKey: true,
        autoIncrement: true
      },
      email: {
        type: Sequelize.STRING,
        unique: true,
        allowNull: false
      },
      createdAt: Sequelize.DATE,
      updatedAt: Sequelize.DATE
    });
  },

  down: async (queryInterface, Sequelize) => {
    await queryInterface.dropTable('users');
  }
};

// Run: npx sequelize-cli db:migrate
// Rollback: npx sequelize-cli db:migrate:undo

TypeORM Migrations

// migrations/1701234567-CreateUsers.ts
import { MigrationInterface, QueryRunner, Table } from 'typeorm';

export class CreateUsers1701234567 implements MigrationInterface {
  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.createTable(
      new Table({
        name: 'users',
        columns: [
          {
            name: 'id',
            type: 'int',
            isPrimary: true,
            isGenerated: true,
            generationStrategy: 'increment'
          },
          {
            name: 'email',
            type: 'varchar',
            isUnique: true
          },
          {
            name: 'created_at',
            type: 'timestamp',
            default: 'CURRENT_TIMESTAMP'
          }
        ]
      })
    );
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.dropTable('users');
  }
}

// Run: npm run typeorm migration:run
// Rollback: npm run typeorm migration:revert

Prisma Migrations

// schema.prisma
model User {
  id        Int      @id @default(autoincrement())
  email     String   @unique
  createdAt DateTime @default(now())
}

// Generate migration: npx prisma migrate dev --name create_users
// Apply: npx prisma migrate deploy

Schema Transformations

Adding Columns with Defaults

// Safe migration: add column with default
module.exports = {
  up: async (queryInterface, Sequelize) => {
    await queryInterface.addColumn('users', 'status', {
      type: Sequelize.STRING,
      defaultValue: 'active',
      allowNull: false
    });
  },

  down: async (queryInterface) => {
    await queryInterface.removeColumn('users', 'status');
  }
};

Renaming Columns (Zero Downtime)

// Step 1: Add new column
module.exports = {
  up: async (queryInterface, Sequelize) => {

…
자주 묻는 질문

ORM이란 무엇인가요?

'Object-Relational Mapping'의 약자입니다. SQL 명령을 직접 쓰지 않고, 이미 알고 있는 프로그래밍 언어로 데이터베이스와 작업할 수 있게 해 주는 기술입니다.

'무중단 배포'란 무엇인가요?

사용자가 서비스를 이용하지 못하는 시간 없이 시스템이나 데이터베이스를 업데이트하는 전략입니다. 전환이 너무 매끄러워 아무도 눈치채지 못하는 것이 목표입니다.

'롤백'이란 무엇인가요?

이미 적용된 변경을 되돌리는 과정입니다. 데이터베이스 업데이트가 문제를 일으키면, 업데이트가 없었던 것처럼 이전 상태로 돌아갈 수 있습니다.

상세 정보

작성자의 원본 설명

Master database schema and data migrations across ORMs (Sequelize, TypeORM, Prisma), including rollback strategies and zero-downtime deployments.

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#4332
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬