migration-patterns
CommunityManage SQLite schema changes with reliable migrations.
System Documentation
What problem does it solve?
This Skill provides a structured and safe approach to managing database schema changes for SQLite, ensuring that your application's database evolves consistently across different environments and deployments. It prevents data loss, schema inconsistencies, and simplifies the process of introducing new features that require database modifications.
Core Features & Use Cases
- Incremental Schema Evolution: Defines database changes as numbered SQL files, ensuring they are applied in a specific order and only once.
- Idempotent Operations: Emphasizes
IF NOT EXISTSfor tables and indexes, making migrations safe to re-run without causing errors. - Dual Schema Management: Maintains both a base
schema.sql(for fresh installs) and incrementalmigrations/*.sql(for updates), ensuring consistency. - Best Practices: Enforces rules like "one feature per migration" and "never modify existing migrations" to maintain a clean and manageable migration history.
- Use Case: You need to add a new
tagstable and acontact_tagsjunction table to an existing CRM database. This Skill guides you through creating the migration file, updating the base schema, and ensuring these changes are applied correctly and safely to all deployed instances of your application.
Quick Start
Create a new SQL file in migrations/ named 00X_your_description.sql.
Inside, use CREATE TABLE IF NOT EXISTS and CREATE INDEX IF NOT EXISTS for all statements.
After creating the migration, also update your schema.sql file with the same changes.
Run your application; the migration runner will automatically detect and apply pending migrations.
Dependency Matrix
Required Modules
None requiredComponents
💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: migration-patterns Download link: https://github.com/spences10/devhub-crm/archive/main.zip#migration-patterns Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.