lightfriend-db-migration

Generate, apply, and rollback Diesel migrations for SQLite or PostgreSQL schemas.

77|10|Updated Feb 1, 2025
One-click install
npx skills add https://github.com/ahtavarasmus/lightfriend --skill lightfriend-db-migration
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: lightfriend-db-migration
Source: https://github.com/ahtavarasmus/lightfriend/tree/main/.claude/skills/lightfriend-db-migration
Command: npx skills add https://github.com/ahtavarasmus/lightfriend --skill lightfriend-db-migration

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill guides developers through safe Diesel-based database migrations, reducing risk and drift when evolving the schema.

Core Features & Use Cases

  • Generate migrations with descriptive names that reflect the schema changes.
  • Write and review up.sql and down.sql to ensure reversible migrations.
  • Run and verify migrations, regenerate Diesel schema, and update Rust models accordingly.
  • Revert migrations when issues are detected to rollback changes safely.

Quick Start

Run the recommended Diesel migration workflow to create, apply, and verify migrations.

Frequently Asked Questions about lightfriend-db-migration

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

FAQPage Schema
How do I create reversible Diesel migrations in Rust to safely evolve a database schema?

To create reversible Diesel migrations, generate a migration with a descriptive name, write the schema changes in up.sql, and create the reversal logic in down.sql. This ensures you can rollback changes safely if issues are detected later.

What is the best way to rollback a database migration using Diesel?

The best way to rollback a Diesel migration is by running the corresponding down.sql file. This skill guides you through writing and executing reversible migrations to revert database schema changes safely when problems occur.

Does Diesel support database migrations for both SQLite and PostgreSQL backends in Rust?

Yes, Diesel supports database migrations for both SQLite and PostgreSQL backends. This skill applies to Rust projects using Diesel, covering generation, editing, applying, and rollback of migrations across these database systems.

How do I regenerate Diesel schema after applying a database migration?

After running and verifying your Diesel migration, you regenerate the schema and update your Rust models accordingly. This ensures your application code stays synchronized with the newly evolved database schema.

Why do I need up.sql and down.sql files for PostgreSQL schema migrations in Rust?

You need up.sql and down.sql files to enforce reversible database schema migrations. up.sql applies the structural changes to PostgreSQL, while down.sql provides the exact rollback commands to safely revert those changes if needed.

What are the limitations of managing Rust database schema changes without a guided Diesel workflow?

Without a guided workflow, managing Rust database schema changes risks schema drift and unsafe modifications. This skill enforces using up.sql, down.sql, migration verification, and schema regeneration to reduce these risks.