Writing database migrations by hand is fiddly — foreign keys, indexes, enum types, nullable columns in the right order. Describe the change you want and Claude will write the migration in seconds.
Write a Laravel migration that adds a `status` column (enum: draft, published, archived)
to the `posts` table, a nullable `published_at` timestamp, and a composite index on
`(status, published_at)`.
Claude knows the conventions of your framework, so the output is idiomatic code — not a generic SQL dump. This works for Laravel, Rails, Django, Doctrine, and more. Just specify which one you're using.
For more complex changes, describe the before and after state:
My `users` table has a single `name` column. Split it into `first_name` and `last_name`.
Write the migration to add the new columns, backfill them by splitting on the first space,
then drop the old column — in the correct order for a safe rollout.
Claude will handle the backfill logic and column ordering, which is easy to get wrong manually. It'll also generate the down() method so your migration is fully reversible.
You can go further and ask Claude to generate multiple migration files for a full feature — it'll figure out the dependency order and name them with appropriate timestamps.
Always review migrations before running them in production — Claude is fast, but your data is irreplaceable.
Log in to leave a comment.
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.
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.
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.