Db migration
An operating system for Claude Code. Skills, hooks (MCR), and a lean-context framework for smarter AI coding sessions.
npx -y skills add justnau1020/claude-os --skill db-migrationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Guide through a database schema change. Use when you need to modify the database schema, add columns, create tables, or run migrations.
SKILL.md
1.9 KB, as published. Nobody here has run it
Database Migration
Guide a database schema change: $ARGUMENTS
Steps
1. Modify the model
Update the relevant model in the project's model/schema directory. ORM classes (SQLModel, SQLAlchemy, Prisma, etc.) define both the application model and the database schema.
2. Create migration
Generate the migration using the project's migration tool:
# Alembic (Python/SQLAlchemy)
alembic revision --autogenerate -m "$ARGUMENTS"
# Prisma (TypeScript/Node)
npx prisma migrate dev --name "$ARGUMENTS"
# Django
python manage.py makemigrations
Review the generated migration before applying.
3. Database-specific limitations
SQLite has limited ALTER TABLE support:
- Can ADD COLUMN
- Cannot DROP COLUMN (before SQLite 3.35)
- Cannot ALTER COLUMN type
- For complex changes, may need to recreate the table
PostgreSQL/MySQL support most ALTER TABLE operations but watch for:
- Lock contention on large tables
- Default values requiring table rewrites
If the migration requires unsupported operations, create a manual migration that:
- Creates a new table with the desired schema
- Copies data from the old table
- Drops the old table
- Renames the new table
4. Backup first
Before running any migration on production data:
# SQLite
cp database.db database.db.backup
# PostgreSQL
pg_dump dbname > backup.sql
5. Apply migration
# Alembic
alembic upgrade head
# Prisma
npx prisma migrate deploy
# Django
python manage.py migrate
6. Test
Write tests to verify:
- New schema works with existing data
- Migration is reversible (if supported by the migration tool)
- Application still functions correctly with the new schema