database-migration

Generate Drizzle ORM migrations for SQLite schema changes with automatic backups.

1|Updated Oct 8, 2025
One-click install
npx skills add https://github.com/fattits30-dev/Justice-Companion --skill database-migration
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-migration
Source: https://github.com/fattits30-dev/Justice-Companion/tree/main/.claude/skills/database-migration
Command: npx skills add https://github.com/fattits30-dev/Justice-Companion --skill database-migration

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires drizzle-orm, better-sqlite3, tsx.

What problem does it solve?

This Skill automates and secures database schema management, eliminating the risks of manual changes, data loss, or corruption. It ensures safe evolution of your SQLite database, especially with encrypted fields and complex rollback scenarios.

Core Features & Use Cases

  • Automated Migration Generation: Creates Drizzle ORM migrations for schema changes (e.g., adding columns, new tables).
  • Safe Rollbacks: Supports reverting to previous database states with automatic pre-migration backups.
  • Encryption-Aware: Manages schema changes while respecting and protecting 11 encrypted database fields.
  • Use Case: When you need to add a new column to a table, Claude generates the migration, automatically backs up your database, applies the changes, and ensures encrypted fields remain secure, preventing data integrity issues.

Quick Start

1. Modify your schema in src/db/schema.ts

(e.g., add a new column to the 'cases' table)

2. Generate a new migration file based on schema changes

pnpm db:generate

3. Review the generated SQL for safety and correctness

4. Apply the migration (an automatic backup will be created first)

pnpm db:migrate

If needed, rollback the last migration to revert changes

pnpm db:migrate:rollback