.claude/skills/migrate/SKILL.md
Create and manage database migrations using goose. Use for schema changes, new tables, or index optimization.
npx skillsauth add PeterBooker/veloria migrateInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Create, run, and validate database migrations using goose.
/migrate create add_user_preferences - Create new migration/migrate up - Run pending migrations/migrate down - Rollback last migration/migrate status - Show migration status/migrate validate - Validate migrations and GORM modelsCreate a new migration file.
Generate migration file
goose -dir migrations create $1 sql
Open the created file and add template:
-- +goose Up
-- +goose StatementBegin
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
-- +goose StatementEnd
Remind about migration rules:
Run all pending migrations.
Ensure binary is current
go install ./...
Check current status
veloria migrate status
Run migrations
veloria migrate up
Verify success
veloria migrate status
Rollback the last migration.
Show current status to confirm which migration will be rolled back
Run rollback
veloria migrate down
Verify rollback by checking status again
Show current migration status.
veloria migrate status
Display:
Validate migrations and check GORM model alignment.
List all migration files
ls -la migrations/*.sql
Read each migration and check for:
Read GORM models in internal/repo/:
plugin.go - Plugin modeltheme.go - Theme modelcore.go - Core modelCompare schema
Report findings
## Migration Validation Report
### Migrations
| File | UP | DOWN | Status |
|------|----|----- |--------|
### Model Alignment
| Model | Table | Issues |
|-------|-------|--------|
### Recommendations
- [specific issues found]
Add indexes for:
user_id, plugin_id)slug, status)created_at, active_installs)Example:
-- +goose Up
CREATE INDEX idx_searches_user_status ON searches(user_id, status);
-- +goose Down
DROP INDEX idx_searches_user_status;
Current schema includes:
users - User accounts with OAuthplugins - WordPress plugin metadatathemes - WordPress theme metadatacores - WordPress core releasessearches - Search history and resultsoauth_identities - OAuth provider credentialssessions - User sessionslargest_repo_files - File size statisticsReview existing migrations in migrations/ before creating new ones.
development
Run Go unit tests. Use after code changes to verify correctness.
development
Run gosec and govulncheck to find security vulnerabilities. Use before releases or after dependency changes.
tools
Trigger reindexing of a specific WordPress extension. Use to rebuild the search index for a plugin, theme, or core version.
development
Run Go race detector to find data races in concurrent code. Use after any change to mutexes, goroutines, or channels.