Skip to content
DB Migration Generator logo

DB Migration Generator

Generator สำหรับสร้าง database migration files พร้อม up/down scripts, validation และ rollback safety

SKILL.md

Full skill instructions

DB Migration Generator

Overview

สร้าง database migration files อัตโนมัติจาก schema changes พร้อม validation, rollback scripts และ safety checks

Why This Matters

  • Safety: Auto-generate rollback scripts
  • Consistency: Standard migration format
  • Validation: Check before apply
  • Documentation: Auto-document changes

Quick Start

# Generate migration
npx generate-migration add_users_table

# Output:
migrations/
└── 20240116120000_add_users_table.ts
    ├── up()    # Apply migration
    └── down()  # Rollback migration

Generated Migration

// 20240116120000_add_users_table.ts
export async function up(db: Database) {
  await db.schema.createTable('users', (table) => {
    table.uuid('id').primary();
    table.string('email').unique().notNullable();
    table.string('name').notNullable();
    table.timestamps(true, true);
  });
  
  await db.schema.createIndex('users', 'email');
}

export async function down(db: Database) {
  await db.schema.dropTable('users');
}

From Schema Diff

# Generate from Prisma schema changes
npx generate-migration --from-prisma

# Detects:
- New tables
- New columns
- Index changes
- Constraint changes

Safety Checks

// Auto-generated safety checks
export async function validate(db: Database) {
  // Check table doesn't exist
  const exists = await db.schema.hasTable('users');
  if (exists) {
    throw new Error('Table users already exists');
  }
  
  // Check dependencies
  // Check data integrity
}

Summary

DB Migration Generator: สร้าง migrations อัตโนมัติ

Features:

  • Up/​down scripts
  • Rollback safety
  • Validation
  • From schema diff

Usage:

npx generate-migration add_users_table
npm run migrate

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View