Database Migration Management

Database Migration Management

Guides an AI agent to manage PostgreSQL and MySQL schema migrations with versioning, non-blocking indexes, column changes, rollbacks and data transformations.

Skill files8 files

references/

scripts/

templates/

SKILL.md92 lines
1
---
2
name: database-migration-management
3
description: >
4
Manage database migrations and schema versioning. Use when planning
5
migrations, version control, rollback strategies, or data transformations in
6
PostgreSQL and MySQL.
7
---
8
9
# Database Migration Management
10
11
## Table of Contents
12
13
- [Overview](#overview)
14
- [When to Use](#when-to-use)
15
- [Quick Start](#quick-start)
16
- [Reference Guides](#reference-guides)
17
- [Best Practices](#best-practices)
18
19
## Overview
20
21
Implement robust database migration systems with version control, rollback capabilities, and data transformation strategies. Includes migration frameworks and production deployment patterns.
22
23
## When to Use
24
25
- Schema versioning and evolution
26
- Data transformations and cleanup
27
- Adding/removing tables and columns
28
- Index creation and optimization
29
- Migration testing and validation
30
- Rollback planning and execution
31
- Multi-environment deployments
32
33
## Quick Start
34
35
Minimal working example:
36
37
```sql
38
-- Create migrations tracking table
39
CREATE TABLE schema_migrations (
40
version BIGINT PRIMARY KEY,
41
name VARCHAR(255) NOT NULL,
42
executed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
43
duration_ms INTEGER,
44
checksum VARCHAR(64)
45
);
46
47
-- Create migration log table
48
CREATE TABLE migration_logs (
49
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
50
version BIGINT NOT NULL,
51
status VARCHAR(20) NOT NULL,
52
error_message TEXT,
53
rolled_back_at TIMESTAMP,
54
executed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
55
);
56
57
-- Function to record migration
58
CREATE OR REPLACE FUNCTION record_migration(
59
p_version BIGINT,
60
p_name VARCHAR,
61
p_duration_ms INTEGER
62
) RETURNS void AS $$
63
// ... (see reference guides for full implementation)
64
```
65
66
## Reference Guides
67
68
Detailed implementations in the `references/` directory:
69
70
| Guide | Contents |
71
|---|---|
72
| [Adding Columns](references/adding-columns.md) | Adding Columns |
73
| [Renaming Columns](references/renaming-columns.md) | Renaming Columns |
74
| [Creating Indexes Non-blocking](references/creating-indexes-non-blocking.md) | Creating Indexes Non-blocking |
75
| [Data Transformations](references/data-transformations.md) | Data Transformations |
76
| [Table Structure Changes](references/table-structure-changes.md) | Table Structure Changes |
77
78
## Best Practices
79
80
### ✅ DO
81
82
- Follow established patterns and conventions
83
- Write clean, maintainable code
84
- Add appropriate documentation
85
- Test thoroughly before deploying
86
87
### ❌ DON'T
88
89
- Skip testing or validation
90
- Ignore error handling
91
- Hard-code configuration values
92

© AJ Geddes · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…