migration-writer

Write reversible SQLite migrations with golang-migrate for the Mediaz project.

Updated Aug 7, 2024
One-click install
npx skills add https://github.com/kasuboski/mediaz --skill migration-writer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migration-writer
Source: https://github.com/kasuboski/mediaz/tree/main/.claude/skills/migration-writer
Command: npx skills add https://github.com/kasuboski/mediaz --skill migration-writer

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing and maintaining database migrations for the Mediaz SQLite store can be error-prone without a repeatable, reversible workflow. This skill provides expert guidance on using golang-migrate, safe table recreation, data-preserving updates, and robust rollback patterns.

Core Features & Use Cases

  • Guided migration patterns: step-by-step templates for up/down migrations, including table recreation and data migrations.
  • Safety-first rules: ensure reversibility, idempotency, and preserved user data across upgrades/downgrades.
  • Testing and validation: instructions for fresh and upgrade tests, including CI-ready examples.
  • Jet model integration: guidance on regenerating code after schema changes and keeping generated models in sync.

Quick Start

Generate the next migration pair following the project's SQLite guidelines.

Frequently Asked Questions about migration-writer

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

FAQPage Schema
How do I write reversible SQLite migrations using golang-migrate?

To write reversible SQLite migrations using golang-migrate, generate dual up/down files ensuring each schema change has a corresponding rollback. This skill enforces idempotent SQL and safe table recreation to preserve data during upgrades and downgrades.

What is the safest way to recreate a SQLite table during a schema migration?

The safest way to recreate a SQLite table during a schema migration is using data-preserving update patterns. This skill provides step-by-step templates for table recreation that ensure user data remains intact across both upgrade and downgrade operations.

How do I test golang-migrate database migrations for safe rollback?

Testing golang-migrate database migrations for safe rollback requires running both fresh and upgrade tests. This skill provides CI-ready testing instructions and validation patterns to verify schema reversibility and idempotency before deployment.

Can I use Jet ORM with SQLite and golang-migrate?

Yes, you can use Jet ORM with SQLite and golang-migrate. This skill guides you through regenerating Jet ORM code after schema changes, ensuring your generated models remain synchronized with your updated SQLite database structure.

Why do my SQLite schema migrations fail to roll back cleanly?

SQLite schema migrations fail to roll back cleanly when SQL statements are not idempotent or down files are missing. This skill enforces dual up/down files and safety-first rules to guarantee reliable, reversible migration workflows.