Agent skill
apply-migration
Apply SQL migration files to JusticeHub Supabase database with verification and error handling.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/apply-migration
SKILL.md
Apply Database Migration
Invocation: /apply-migration <migration-file>
Usage
/apply-migration 20260102_alma_unification_links.sql
How It Works
- Reads migration from
supabase/migrations/ - Connects to Supabase using
.env.localcredentials - Executes SQL via direct PostgreSQL connection
- Verifies created tables/columns
- Logs success/failure
Prerequisites
.env.localwithNEXT_PUBLIC_SUPABASE_URL,SUPABASE_DB_PASSWORD- Migration file in
supabase/migrations/ pglibrary installed
Connection
postgresql://postgres:PASSWORD@HOST:6543/postgres
Fallback to session pooler if direct fails.
Success Output
✅ Migration executed successfully!
🔍 Verifying tables...
✅ article_related_interventions
✅ alma_intervention_profiles
🎉 Migration Complete!
Failure Output
❌ Error: syntax error at or near "CRATE"
📋 Manual alternative:
1. Open Supabase Dashboard → SQL Editor
2. Copy from: supabase/migrations/bad_migration.sql
3. Fix syntax and run
Safety Features
- Transaction safety
- Idempotent checks (
IF NOT EXISTS) - Proper connection cleanup
- Backup reminder
Files
- Script:
scripts/apply-migration-skill.mjs - Migrations:
supabase/migrations/*.sql
Related
/create-migration- Generate new migration/verify-schema- Check database schema
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?