database-migrations-sql-migrations
SQL 데이터베이스 마이그레이션 마스터
이 스킬은 내장된 롤백 절차와 유효성 검사를 통해 PostgreSQL, MySQL 및 SQL Server의 무중단 데이터베이스 마이그레이션을 구현할 수 있도록 도와줍니다.
스킬 ZIP 다운로드
Claude에서 업로드
설정 → 기능 → 스킬 → 스킬 업로드로 이동
토글을 켜고 사용 시작
테스트해 보기
"database-migrations-sql-migrations" 사용 중입니다. Create a zero-downtime migration to add a status column to orders table
예상 결과:
- 마이그레이션 분석 보고서
- 1. 전략: 확장-수축 패턴
- 2. 1단계 (확장): nullable status 컬럼 추가
- 3. 2단계 (마이그레이션): 배치로 state 컬럼에서 status 백필
- 4. 3단계 (수축): 코드 배포 후 이전 state 컬럼 제거
- 5. 검증: 행 개수 일치, 데이터 손실 없음
- 6. 롤백: 검증 실패 시 스냅샷으로 복원
"database-migrations-sql-migrations" 사용 중입니다. Write a rollback script for version 001 migration
예상 결과:
- v001용 롤백 스크립트
- - 현재 버전 일치 확인
- - 롤백 전 백업 생성
- - down.sql 마이그레이션 실행
- - 마이그레이션 레코드 제거
- - 롤백 성공 검증
보안 감사
안전All 63 static findings are false positives. The skill provides legitimate SQL migration examples including PostgreSQL functions (gen_random_uuid, pg_sleep), database introspection queries (pg_indexes), and configuration references. No actual command injection, weak cryptography, or data exfiltration present. This is a benign database migration guidance skill.
중간 위험 문제 (2)
낮은 위험 문제 (2)
품질 점수
만들 수 있는 것
중단 없이 새 컬럼 추가
배치 데이터 백필과 함께 확장-수축 패턴을 사용하여 대용량 프로덕션 테이블에 NOT NULL 컬럼을 안전하게 추가합니다.
레거시 스키마 새 구조로 마이그레이션
이중 쓰기 동기화가 있는 블루-그린 마이그레이션을 사용하여 데이터 손실 없이 레거시에서 새 스키마로 마이그레이션합니다.
안전한 롤백 절차 생성
실패한 마이그레이션에서 복구하기 위한 마이그레이션 전 스냅샷과 검증 검사가 포함된 자동화된 롤백 스크립트를 생성합니다.
이 프롬프트를 사용해 보세요
Create a migration script to add a new column called email_verified (BOOLEAN, DEFAULT FALSE) to the users table in PostgreSQL. Include proper error handling.
Generate a zero-downtime migration strategy to convert a VARCHAR column to ENUM type in a production MySQL database with 10M+ rows.
Write a migration to move data from the legacy orders table to a new v2_orders table. Include pre-validation checks, batched backfill, and post-migration row count verification.
Create a full migration package for adding a JSONB metadata column to the products table. Include: forward migration SQL, rollback SQL, validation checks, and a shell script for execution with proper error handling.
모범 사례
- 프로덕션에서 마이그레이션 실행 전 항상 데이터베이스 스냅샷 또는 백업 생성
- 마이그레이션 단계의 원자성을 보장하려면 트랜잭션 블록(BEGIN/COMMIT) 사용
- 데이터 손실 감지를 위해 마이그레이션 전후 행 개수 검증
- 프로덕션을 미러링하는 스테이징 환경에서 마이그레이션 테스트
피하기
- 마이그레이션 전 검증 없이 프로덕션에서 직접 마이그레이션 실행
- PostgreSQL에서 대용량 테이블에 CONCURRENTLY 플래그 없이 ALTER TABLE 사용
- 프로duction에서 스키마 변경에 대한 롤백 절차 건너뛰기
- 마이그레이션 중 외래 키 제약 조건과 참조 무결성 고려하지 않음