Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

Back to skills

Database Migrations

ASecurity

Use when database migration best practices for schema changes, data migrations, rollbacks, and zero-downtime deployments across PostgreSQL, MySQL, and common ORMs (Prisma, Drizzle, Kysely, Django, TypeORM, golang-migrate). Triggers on \"database-migrations\", \"database migrations\", \"migrations\".

2 stars
0 votes
0 copies
0 views
Added 9/19/2026
databasesgosqldjangodatabase

Security Analysis

A100/100

Scanned 9/19/2026

Install to Claude Code

$npx -y skills add majinmagros/magros.ai-skills --skill database-migrations --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Database Migrations?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Database Migrations
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majinmagros-database-migrations/badge)](https://www.skillsdirectory.com/skills/majinmagros-database-migrations)

More formats (shields.io, HTML) on the badges page.

Download Zip
Files
SKILL.md
---
name: database-migrations
description: "Use when database migration best practices for schema changes, data migrations, rollbacks, and zero-downtime deployments across PostgreSQL, MySQL, and common ORMs (Prisma, Drizzle, Kysely, Django, TypeORM, golang-migrate). Triggers on \"database-migrations\", \"database migrations\", \"migrations\"."
metadata:
  origin: ECC
---

# Database Migration Patterns

Safe, reversible schema changes: forward-only in production, schema and data migrations separate, expand-contract for renames. Detalhes em `references/`.

## 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 manually
2. **Forward-only in production** — rollbacks are new forward migrations
3. **Schema and data separate** — never mix DDL and DML
4. **Test at production scale** — 100 rows OK can lock at 10M
5. **Immutable once deployed** — never edit a ran migration

## Safety Checklist

- [ ] UP and DOWN (or explicitly irreversible)
- [ ] No full table locks (concurrent ops on large tables)
- [ ] New columns nullable or with default
- [ ] Indexes via `CONCURRENTLY`, backfill in separate migration
- [ ] Tested on production-data copy, rollback plan documented

## Example

```sql
-- Safe: nullable first, no lock, no rewrite
ALTER TABLE users ADD COLUMN avatar_url TEXT;

-- Unsafe: NOT NULL without default rewrites every row
-- ALTER TABLE users ADD COLUMN role TEXT NOT NULL;
```

## References

- `references/postgres-patterns.md` — safe ADD COLUMN, concurrent index, rename/drop, batched backfill
- `references/orms-ts.md` — Prisma, Drizzle, Kysely workflows + migration files
- `references/orms-py-go.md` — Django data migrations, SeparateDatabaseAndState, golang-migrate
- `references/zero-downtime.md` — expand-contract phases, timeline, anti-patterns table

Attribution

majinmagrosmajinmagros
View sourceMore from majinmagros →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Mysql Best Practices

MySQL development best practices for schema design, query optimization, and database administration

2481 votes

Jpa Patterns

Spring Boot中的JPA/Hibernate实体设计、关系、查询优化、事务、审计、索引、分页和连接池模式。

2456590 votes

Postgres Patterns

基于Supabase最佳实践的PostgreSQL数据库模式,用于查询优化、架构设计、索引和安全。

2456590 votes

Clickhouse Io

ClickHouse数据库模式、查询优化、分析和数据工程最佳实践,适用于高性能分析工作负载。

2456590 votes

V3 Memory Unification

Unify 6+ memory systems into AgentDB with HNSW indexing for 150x-12,500x search improvements. Implements ADR-006 (Unified Memory Service) and ADR-009 (Hybrid Memory Backend).

701370 votes
View all in databases →