database-migrations
Database migration best practices for schema changes, data migrations, rollbacks, and zero-downtime deployments across PostgreSQL, MySQL, and common ORMs…
Skill by mturac
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/mturac-database-migrations
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend, data
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/database-migrations
What's inside
- Skill name
database-migrations- Description
- Database migration best practices for schema changes, data migrations, rollbacks, and zero-downtime deployments across PostgreSQL, MySQL, and common ORMs (Prisma, Drizzle, Django, TypeORM, golang-migrate). Use when planning or implementing database schema changes.
- License
- MIT
- Metadata
- origin: ecc
- Instructions
- 339 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Database Migration Patterns
Safe, reversible database schema changes for production systems.
## When to Activate
- Creating or altering database tables
- Adding/removing columns or indexes
- Running data migrations (backfill, transform)
- Planning zero-downtime schema changes
- Setting up migration tooling for a new project
## Core Principles
1. **Every change is a migration** — never alter production databases manually
2. **Migrations are forward-only in production** — rollbacks use new forward migrations
3. **Schema and data migrations are separate** — never mix DDL and DML in one migration
4. **Test migrations against production-sized data** — a migration that works on 100 rows may lock on 10M
5. **Migrations are immutable once deployed** — never edit a migration that has run in production
## Migration Safety Checklist
Before applying any migration:
- [ ] Migration has both UP and DOWN (or is explicitly marked irreversible)
- [ ] No full table locks on large tables (use concurrent operations)
- [ ] New columns have defaults or are nullable (never add NOT NULL without default)
- [ ] Indexes created concurrently (not inline with CREATE TABLE for existing tables)
- [ ] Data backfill is a separate migration from schema change
- [ ] Tested against a copy of production data
- [ ] Rollback plan documented
## PostgreSQL Patterns
### Adding a Column Safely
```sql
-- GOOD: Nullable column, no lock
ALTER TABLE users ADD COLUMN avatar_url TEXT;
-- GOOD: Column with default (Postgres 11+ is instant, no rewrite)
ALTER TABLE users ADD COLUMN is_active BOOLEAN NOT NULL DEFAULT true;
-- BAD: NOT NULL without default on existing table (requires full rewrite)
ALTER TABLE users ADD COLUMN role TEXT NOT NULL;
-- This locks the table and rewrites every row
```
### Adding an Index Without Downtime
```sql
-- BAD: Blocks writes on large tables
CREATE INDEX idx_users_email ON users (email);
-- GOOD: Non-blocking, allows concurrent writes
CREATE INDEX CONCURRENTLY idx_users_email ON users (email);
-- Note: CONCURRENTLY cannot run inside a transaction block
-- Most migration tools need special handling for this
```
### Renaming a Column (Zero-Downtime)
Never rename directly in production. Use the expand-contract pattern:
```sql
-- Step 1: Add new column (migration 001)
ALTER TABLE users ADD COLUMN display_name TEXT;
-- Step 2: Backfill data (migration 002, data migration)
UPDATE users SET display_name = username WHERE display_name IS NULL;
-- Step 3: Update application code to read/write both columns
-- Deploy application changes
-- Step 4: Stop writing to old column, drop it (migration 003)
ALTER TABLE users DROP COLUMN username;
```
### Removing a Column Safely
```sql
-- Step 1: Remove all application references to the column
-- Step 2: Deploy application without the column reference
-- Step 3: Drop column in next migration
ALTER TABLE orders DROP COLUMN legacy_status;
-- For Django: use SeparateDatabaseAndState to remove from model
-- without generating DROP COLUMN (then drop in next migration)
```
### Large Data Migrations
```sql
-- BAD: Updates all rows in one transaction (locks table)
UPDATE users SET normalized_email = LOWER(email);
-- GOOD: Batch update with progress
DO $$
DECLARE
batch_size INT := 10000;
rows_updated INT;
BEGIN
LOOP
UPDATE users
SET normalized_email = LOWER(email)
WHERE id IN (
SELECT id FROM users
WHERE normalized_email IS NULL
LIMIT batch_size
FOR UPDATE SKIP LOCKED
);
GET DIAGNOSTICS rows_updated = ROW_COUNT;
RAISE NOTICE 'Updated % rows', rows_updated;
EXIT WHEN rows_updated = 0;
COMMIT;
END LOOP;
END $$;
```From mturac/everything-openai-codex, MIT.
More from mturac/everything-openai-codex
- 0.581score
x-api
mturac
X/Twitter API integration for posting tweets, threads, reading timelines, search, and analytics.
SkillCFreshness: C★ 83Claude Code +9 - 0.581score
deployment-patterns
mturac
Deployment workflows, CI/CD pipeline patterns, Docker containerization, health checks, rollback strategies, and production readiness checklists for web…
SkillCFreshness: C★ 83Claude Code +9 - 0.581score
docker-patterns
mturac
Docker and Docker Compose patterns for local development, container security, networking, volume strategies, and multi-service orchestration.
SkillCFreshness: C★ 83Claude Code +9 - 0.581score
fal-ai-media
mturac
Unified media generation via fal.ai MCP — image, video, and audio.
SkillCFreshness: C★ 83Claude Code +9 - 0.581score
documentation-lookup
mturac
Use up-to-date library and framework docs via Context7 MCP instead of training data.
SkillCFreshness: C★ 83Claude Code +9 - 0.581score
dmux-workflows
mturac
Multi-agent orchestration using dmux (tmux pane manager for AI agents).
SkillCFreshness: C★ 83Claude Code +9 - 0.581score
investor-materials
mturac
Create and update pitch decks, one-pagers, investor memos, accelerator applications, financial models, and fundraising materials.
SkillCFreshness: C★ 83Claude Code +9 - 0.581score
investor-outreach
mturac
Draft cold emails, warm intro blurbs, follow-ups, update emails, and investor communications for fundraising.
SkillCFreshness: C★ 83Claude Code +9 - 0.581score
market-research
mturac
Conduct market research, competitive analysis, investor due diligence, and industry intelligence with source attribution and decision-oriented summaries.
SkillCFreshness: C★ 83Claude Code +9 - 0.581score
mle-workflow
mturac
Production machine-learning engineering workflow for data contracts, reproducible training, model evaluation, deployment, monitoring, and rollback.
SkillCFreshness: C★ 83Claude Code +9 - 0.581score
exa-search
mturac
Neural search via Exa MCP for web, code, and company research.
SkillCFreshness: C★ 83Claude Code +9 - 0.581score
product-capability
mturac
Translate PRD intent, roadmap asks, or product discussions into an implementation-ready capability plan that exposes constraints, invariants, interfaces, and…
SkillCFreshness: C★ 83Claude Code +9
Signals
- Stars
- 83
- Forks
- 2
- Open issues
- 1
- Last commit (this folder)
- May 18, 2026 (5 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
More from mturac
- 0.581score
investor-materials
mturac
Create and update pitch decks, one-pagers, investor memos, accelerator applications, financial models, and fundraising materials.
SkillCFreshness: C★ 83Claude Code +9 - 0.581score
exa-search
mturac
Neural search via Exa MCP for web, code, and company research.
SkillCFreshness: C★ 83Claude Code +9 - 0.581score
fal-ai-media
mturac
Unified media generation via fal.ai MCP — image, video, and audio.
SkillCFreshness: C★ 83Claude Code +9 - 0.581score
documentation-lookup
mturac
Use up-to-date library and framework docs via Context7 MCP instead of training data.
SkillCFreshness: C★ 83Claude Code +9 - 0.581score
dmux-workflows
mturac
Multi-agent orchestration using dmux (tmux pane manager for AI agents).
SkillCFreshness: C★ 83Claude Code +9 - 0.581score
investor-outreach
mturac
Draft cold emails, warm intro blurbs, follow-ups, update emails, and investor communications for fundraising.
SkillCFreshness: C★ 83Claude Code +9
Cite this page
database-migrations skill. Agent Mart. https://agentmart.dev/skills/mturac-database-migrations (last updated 2026-10-24)