What problem does it solve?
CircleTel relies on database migrations to evolve its PostgreSQL schema safely across environments. Without a standardized workflow, migrations can be misordered, lack proper RLS scoping, and risk data integrity during deployments. This skill provides an opinionated, auditable process to generate, validate, and rollback migrations for Supabase projects.
Core Features & Use Cases
- Migration generation and naming: create timestamped SQL files in supabase/migrations with a clear YYYYMMDDHHMMSS_description.sql convention.
- Validation and safety checks: verify syntax, RLS enablement, indexes on foreign keys, and timestamp columns.
- Rollback ready: scaffolds rollback migrations and supports local testing and staged deployments.
- Local testing and deployment: enables testing via supabase db reset and migration up, with clear promotion to staging/production.
Quick Start
- Create a new migration: python .claude/skills/database-migration/scripts/generate_migration.py "add new feature table"
- Review and edit the generated file in supabase/migrations/ (the tool names the file with a timestamp)
- Validate the migration: python .claude/skills/database-migration/scripts/validate_migration.py supabase/migrations/20251108120000_add_feature_table.sql
- Apply locally: npx supabase db reset && npx supabase migration up
- Push to staging: git add supabase/migrations/; git commit -m "feat: Add feature table migration"; git push origin feature/migration-name:staging