# Plan Safe Zero-Downtime SQL Migrations

Database migrations can lock tables, corrupt data, or leave applications incompatible. This skill creates staged plans with validation, rollback, batching, and zero-downtime strategies.

## Install

```bash
npx skillstore add sickn33/database-migrations-sql-migrations
```

## Metadata

- Status: approved
- Slug: sickn33-database-migrations-sql-migrations
- Skillstore revision: r2
- Version status: missing
- Tree hash: dd51dbd6a69786ea7ad9a558a2bfff5e308c7e8b672e545c79aa5221d202c737
- Author: sickn33
- GitHub username: sickn33
- License: MIT
- Repository: https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/database-migrations-sql-migrations
- Ref: f9e2c34b4f19c7f3e6b0a1e93227b5f77cc12526
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: confirmation\_required
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands
- Quality score: 38
- Quality tier: warning
- Public page: https://skillstore.pages.dev/skills/sickn33-database-migrations-sql-migrations
- Manifest: https://skillstore.pages.dev/api/skills/sickn33-database-migrations-sql-migrations/manifest

## Capabilities

- Designs expand-contract and blue-green schema migration plans.
- Generates version-controlled SQL migration and rollback outlines.
- Provides Flyway and Alembic migration patterns.
- Defines pre-migration and post-migration integrity checks.
- Plans batched and parallel processing for large tables.
- Suggests index management and deployment sequencing to reduce disruption.

## Use Cases

- Add Fields Without Downtime: Plan a backward-compatible schema change while old and new application versions run together.
- Backfill Large Production Tables: Define batches, throttling, checkpoints, and validation for a high-volume data migration.
- Build Migration Release Gates: Create deployment sequencing, rollback criteria, and verification steps for automated delivery workflows.

## Prompt Templates

### Plan a Basic Column Migration

```
Create a safe migration plan to add [column] to [table] on [database]. Include prerequisites, validation checks, and rollback steps.
```

### Design an Expand-Contract Change

```
Design an expand-contract migration for [schema change] while [old version] and [new version] run concurrently. Include deployment order and compatibility checks.
```

### Plan a Large-Table Backfill

```
Plan a zero-downtime backfill for [table] containing [row count] rows. Define batch sizing, throttling, progress checks, failure recovery, and index handling.
```

### Audit a Production Migration

```
Review this proposed migration: [plan]. Identify locking, integrity, injection, rollback, and compatibility risks. Produce a revised sequence with go or no-go gates.
```

## Limitations

- Generated scripts are not executed or tested against your database.
- Examples favor PostgreSQL and require adaptation for MySQL or SQL Server.
- Accurate plans require schema, engine version, data volume, traffic, and deployment constraints.
- Destructive changes still require backups, staging tests, and expert review.

## Best Practices

- Collect engine version, table size, traffic patterns, replication limits, and recovery objectives before designing the migration.
- Separate schema expansion, data backfill, application rollout, and schema contraction into independently verifiable releases.
- Test forward and rollback paths with production-like data, then monitor locks, errors, lag, and migration progress.

## Anti Patterns

- Do not run generated migration examples directly in production without environment-specific review and testing.
- Do not combine destructive schema changes with application dependencies in one irreversible deployment.
- Do not interpolate untrusted table names, column names, versions, or paths into SQL and shell commands.

## Security Audit

- Audited at: 2026-07-23T22:42:16.019\+00:00
- Summary: The skill contains documentation and code samples; none automatically execute commands or access SQLite files, so all 33 static alerts are false positives for those patterns. However, the rollback and Python examples interpolate unvalidated values into SQL and paths, creating adoption-time injection and file-selection risks. No prompt injection, network access, credential exfiltration, or hidden execution was found.

## Stats

- Views: 110
- Downloads: 13
- Favorites: 0
- Popularity score: 0
