Database Migration

VerifiedSafe

Handles safe database schema changes and data migrations. Use when adding or modifying database tables, columns, relationships, or performing data transformations. Ensures migrations are reversible, tested, and avoid data loss.

Sby Skills Guide Bot
DevelopmentIntermediate
6/2/2026
Claude CodeCursorWindsurf
#database-migration#schema-management#reversible-migrations

Recommended for

Automated summary

Handles safe database schema changes and data migrations with a focus on reversibility and best practices.

Strengths

  • Every migration is reversible with both up and down scripts
  • One change per migration to avoid conflicts and simplify rollbacks
  • Enforces testing on dev and backup before production deployment
  • Checklist for dangerous operations (rename, drop, type changes)

Limitations

  • Geared towards Drizzle ORM (not directly applicable to other ORMs)
  • Requires understanding of database schema design
  • Can be overkill for trivial schema tweaks
When to use it

When you need to add, modify, or remove database tables or columns safely, with a clear rollback plan.

When not to use it

For ad-hoc data fixes that don't require migration scripts or when using a non-Drizzle ORM without adapting the workflow.

Security analysis

Safe
Quality score90/100

The skill provides standard, non-destructive database migration guidelines. It does not contain any instructions for exfiltration, disabling safety measures, or running obfuscated payloads. The mentioned commands are common development tools and do not pose a risk when used as intended.

No concerns found

How this analysis is made

Examples

Add user roles table
Generate a database migration to create a 'roles' table with columns id, name, and description. Follow the reversible migration pattern with up and down scripts.
Rename column safely
Create a migration to rename 'email' column to 'user_email' in the users table using the three-step approach: add new column, copy data, drop old column.

Skill: Database Migration

Description

Handles safe database schema changes and data migrations.

When to Use

  • Adding/modifying database tables or columns
  • Changing relationships between entities
  • Data transformations

Instructions

Migration Rules

  1. Always reversible — every migration needs an up and down
  2. One change per migration — don't bundle unrelated schema changes
  3. Test on dev first — never run untested migrations in production
  4. Backup before production — always have a rollback plan
  5. No data loss — add columns as nullable first, then backfill

Drizzle Workflow

# Generate migration from schema changes
npx drizzle-kit generate

# Review generated SQL in drizzle/ folder
# Apply migration
npx drizzle-kit push

# Or use migrate for production
npx drizzle-kit migrate

Naming Convention

YYYYMMDD_HHMMSS_description.sql Example: 20260212_143000_add_user_roles.sql

Dangerous Operations Checklist

  • [ ] Column rename → Create new, copy data, drop old (3-step)
  • [ ] Column type change → Verify data compatibility first
  • [ ] Drop table → Confirm no foreign key references
  • [ ] Add NOT NULL → Set default or backfill first

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/database-migration-mm5t8ch1/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/database-migration-mm5t8ch1' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/database-migration-mm5t8ch1/download' --output '.skill-downloads/database-migration-mm5t8ch1/SKILL.md.part' && mv '.skill-downloads/database-migration-mm5t8ch1/SKILL.md.part' '.skill-downloads/database-migration-mm5t8ch1/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

This file does not provide a usable name/description header for this native procedure. It remains available to download and inspect; use the manual method below.

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/database-migration-mm5t8ch1/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills