db-migrations

Generate idempotent database migrations with clear naming and safe SQL patterns.

Updated Dec 12, 2024
One-click install
npx skills add https://github.com/kingmacth/lobe-chat --skill db-migrations-kingmacth
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: db-migrations
Source: https://github.com/kingmacth/lobe-chat/tree/main/.agents/skills/db-migrations
Command: npx skills add https://github.com/kingmacth/lobe-chat --skill db-migrations-kingmacth

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Database migrations are error-prone and require careful planning when generating migrations, writing migration SQL, or changing schemas; this guide helps ensure idempotent, safe migrations.

Core Features & Use Cases

  • Clear migration naming conventions to avoid drift
  • Safe, idempotent SQL patterns for CREATE/ALTER/DROP
  • Procedures for validating migrations against schemas and enabling rollbacks

Quick Start

Run the migration generator to produce idempotent migrations and apply them safely across schemas.

Frequently Asked Questions about db-migrations

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write idempotent SQL for database schema changes?▼

Idempotent SQL schema changes ensure migration scripts execute safely multiple times without failing. This guide enforces non-destructive CREATE/ALTER/DROP patterns and repeatable scripts to prevent schema drift across different database systems.

What is the best way to structure database migrations to avoid schema drift?▼

The best way to avoid schema drift is using clear migration naming conventions and idempotent SQL patterns. This approach enforces non-destructive edits and repeatable procedures for validating migrations against evolving schemas.

How do I create safe database migrations that support rollbacks?▼

Safe database migrations supporting rollbacks require clear naming conventions and non-destructive edits. This guide provides procedures for validating migrations against schemas to ensure reliable schema evolution and secure rollback paths.

Can these migration best practices work across different database systems?▼

Yes, these migration best practices apply across different database systems. The guide focuses on universal, idempotent SQL patterns and non-destructive schema change procedures rather than locking you into a specific database platform.

Why do my database migrations fail when run multiple times?▼

Database migrations fail when run multiple times because the SQL scripts are not idempotent. Writing idempotent migrations using non-destructive CREATE/ALTER/DROP patterns and clear naming conventions ensures they execute reliably without errors.