Migrate

From PeterBooker/veloria · View interactive version

Migrate is an AI agent skill from the GitHub repository PeterBooker/veloria. Create and manage database migrations using goose. Use for schema changes, new tables, or index optimization.

How to use this skill

Skill file

Database Migration Management

Create, run, and validate database migrations using goose.

Usage

Commands

create [name]

Create a new migration file.

  1. Generate migration file

```bash

goose -dir migrations create $1 sql

```

  1. Open the created file and add template:

```sql

-- +goose Up

-- +goose StatementBegin

-- +goose StatementEnd

-- +goose Down

-- +goose StatementBegin

-- +goose StatementEnd

```

  1. Remind about migration rules:

up

Run all pending migrations.

  1. Ensure binary is current

```bash

go install ./...

```

  1. Check current status

```bash

veloria migrate status

```

  1. Run migrations

```bash

veloria migrate up

```

  1. Verify success

```bash

veloria migrate status

```

down

Rollback the last migration.

  1. Show current status to confirm which migration will be rolled back
  1. Run rollback

```bash

veloria migrate down

```

  1. Verify rollback by checking status again

status

Show current migration status.

veloria migrate status

Display:

validate

Validate migrations and check GORM model alignment.

  1. List all migration files

```bash

ls -la migrations/*.sql

```

  1. Read each migration and check for:
  1. Read GORM models in internal/repo/:
  1. Compare schema
  1. Report findings

```

## Migration Validation Report

### Migrations

| File | UP | DOWN | Status |

|------|----|----- |--------|

### Model Alignment

| Model | Table | Issues |

|-------|-------|--------|

### Recommendations

```

Migration Best Practices

DO

DON'T

Index Guidelines

Add indexes for:

Example:

-- +goose Up
CREATE INDEX idx_searches_user_status ON searches(user_id, status);

-- +goose Down
DROP INDEX idx_searches_user_status;

Existing Tables

Current schema includes:

Review existing migrations in migrations/ before creating new ones.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.