$ recombobulate _
home / tips / describe-schema-changes-in-english-and-let-claude-write-the-migration
204

Describe Schema Changes in English and Let Claude Write the Migration

recombobulate @recombobulate · Mar 29, 2026 · Workflows
describe-schema-changes-in-english-and-let-claude-write-the-migration

Database migrations are tedious to write by hand — especially when they involve multiple tables, foreign keys, and indexes. Describe what you want in English and Claude handles the schema.

"Add a tagging system — posts should be able to have multiple tags, and tags should be reusable across posts"

Claude reads your existing models and schema, then generates everything needed — migration files, model updates, relationships, and indexes:

// Claude creates the migration
Schema::create('tags', function (Blueprint $table) {
    $table->id();
    $table->string('name')->unique();
    $table->string('slug')->unique();
    $table->timestamps();
});

Schema::create('post_tag', function (Blueprint $table) {
    $table->foreignId('post_id')->constrained()->cascadeOnDelete();
    $table->foreignId('tag_id')->constrained()->cascadeOnDelete();
    $table->primary(['post_id', 'tag_id']);
});

This works for any complexity:

# Simple column additions
"Add a phone number and date of birth to the users table"

# Relationships
"Users should be able to belong to multiple teams, with a role in each team"

# Complex changes
"Add a polymorphic comments system — users can comment on posts, products, and orders"

# Modifications
"Change the price column from integer cents to a decimal with 2 decimal places, 
and add a currency column that defaults to USD"

# With constraints
"Add a unique constraint on email per organization — different orgs can have 
the same email but not within the same org"

Claude also handles the tricky parts:

  • Rollback safety — writes proper down() methods so migrations are reversible
  • Data preservation — when modifying existing columns, handles the transformation without losing data
  • Index strategy — adds indexes for foreign keys and commonly queried columns
  • Framework conventions — follows your ORM's naming conventions for tables, columns, and pivots

After writing the migration, ask Claude to update the models too:

"Now update the Post and Tag models with the relationships and any scopes"

Schema changes start as ideas in your head — describe them in words, let Claude write the SQL.

via Claude Code

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Run Claude Code in GitHub Actions to Automatically Review Every Pull Request

Set up Claude Code as an automated reviewer in your CI pipeline — on every pull request, it reads the diff, checks for bugs, security issues, missing tests, and convention violations, then posts its findings as a PR comment. Your human reviewers get a head start because the obvious issues are already flagged before they look.

recombobulate @recombobulate · 1 day ago
0
Ask Claude to Build a Deployment Checklist from Your Actual Infrastructure

Before deploying, tell Claude to read your project — migrations, environment variables, queue workers, scheduled tasks, caching, third-party integrations — and generate a deployment checklist that's specific to your app. Not a generic "did you run migrations?" list, but one that knows YOUR infrastructure and catches the things YOUR deploy can break.

recombobulate @recombobulate · 1 day ago
0
Ask Claude to Generate a README from Your Actual Codebase — Not a Template

Instead of writing a README from memory or copying a template, tell Claude to read your project and generate one that's actually accurate — real setup instructions from your config, real architecture from your directory structure, real API examples from your routes, and real prerequisites from your dependency files.

recombobulate @recombobulate · 1 day ago