TL;DR
Auto DB Migrations on Push is a devops workflow that chains Supabase + GitHub to automate a common task. Every push to main triggers a Supabase migration automatically. Schema diffs are committed and applied with zero manual steps. Once configured, it runs through Claude Code, Cursor, Windsurf or any MCP-compatible AI agent.
Auto DB Migrations on Push
Every push to main triggers a Supabase migration automatically. Schema diffs are committed and applied with zero manual steps.
How it works
Run with MCPizy
NewExecute this recipe in your browser — no local install, no Claude Code. Streams results live.
Why this combo?
Supabase handles your database schema and GitHub tracks your code changes. Together, they eliminate the manual step of applying migrations — every push with SQL changes triggers automatic schema updates on staging. This closes the gap between code and schema that causes the most deployment-day incidents.
Without this workflow
SSH into server, run migration script manually, hope nothing breaks, verify schema by hand, document the change in a spreadsheet.
With MCPizy
Push code. Migrations apply automatically. Status posted as a PR comment. Zero manual steps.
Business value
Concrete ROI — not marketing fluff.
Time saved
- Cuts deployment friction — engineers stop context-switching to run migration scripts manually
- Auditable trail: every schema change tied to a PR + commit SHA for SOC2/compliance reviews
Workflow steps
- 1GitHub webhook fires on push to main
- 2Extract changed SQL files from diff
- 3Run migration via Supabase MCP
- 4Commit migration receipt back to repo
- 5Post migration summary as PR comment
Use cases
- Auto-apply schema changes on every PR merge to main
- Rollback migrations automatically when PRs are reverted
- Preview database schema diffs in PR comments before merging
- Keep staging and production schemas always in sync
Agent prompt (copy into Claude Code)
This prompt is the workflow. Paste into Claude Code, Cursor, or Windsurf.
You are a database migration agent. Every push to main triggers this workflow. On GitHub push event to main: 1. Call github.list_pull_requests to find the merged PR and get the commit diff 2. Filter changed files for any matching supabase/migrations/*.sql 3. For each new migration file, call supabase.apply_migration(name, query) with the file contents 4. If apply_migration returns an error, call github.create_issue with title "Migration failed: <file>" and the error body 5. On success, call github.add_pr_comment with a summary table: file | status | duration Reply only with the migration receipt: "Applied N migrations — SHA <commit>".
Trigger & credentials
How this workflow fires and what env vars you need.
POST /webhook/github (add in GitHub repo → Settings → Webhooks, event: push to main)
GITHUB_WEBHOOK_SECRETWebhook signing secret (set when creating webhook)
e.g. a-long-random-string
One-command deploy
Install everything — MCPs, prompt, env template — in a single call.
$ mcpizy recipe install supabase-github-db-migrations ✓ Installs all 2 MCP servers ✓ Writes prompt to ~/.mcpizy/prompts/supabase-github-db-migrations.md ✓ Generates .env.example in current directory ✓ Ready to paste into Claude Code
Requires mcpizy CLI v1.1+ — install via npm i -g mcpizy.
Quick install (MCPs only)
$ mcpizy install supabase && mcpizy install githubMore DevOps recipes
Preview Deploy on Every PR
Open a PR and a Vercel preview URL appears as a comment within minutes. Branches are cleaned up automatically when PRs close.
Container Deployment to AWS
Build, tag, push to ECR and deploy to ECS in one automated pipeline triggered by a git tag or manual dispatch.
Branch-per-PR Databases
Each PR gets its own Neon database branch for isolated testing. Branch is deleted automatically when the PR closes.
Issue → Branch → PR Pipeline
A Linear issue assigned to a developer automatically creates a git branch, syncs status changes, and opens a draft PR.
Frequently asked questions
What is this workflow?
Auto DB Migrations on Push is a devops automation that uses Supabase + GitHub together via the Model Context Protocol. Every push to main triggers a Supabase migration automatically. Schema diffs are committed and applied with zero manual steps.
How long does setup take?
Setup takes around 10 min setup, then fully automated. You install the required MCP servers with `mcpizy install supabase && mcpizy install github`, connect your accounts, and the workflow is ready to run.
What does this workflow change in practice?
Cuts deployment friction — engineers stop context-switching to run migration scripts manually; Auditable trail: every schema change tied to a PR + commit SHA for SOC2/compliance reviews.
Which MCP servers do I need for this?
You need 2 MCP servers: Supabase (mcpizy install supabase), GitHub (mcpizy install github). All are installable in one command via the MCPizy CLI and configured in your `.claude.json` or `.cursor/mcp.json`.
Does this work with Claude Code, Cursor, and Windsurf?
Yes. The workflow runs with any MCP-compatible AI agent — Claude Code, Claude Desktop, Cursor, Windsurf, VS Code with Copilot, and custom agents built on the MCP SDK. The MCP servers are identical across clients; only the config file path (`.claude.json` vs `.cursor/mcp.json`) changes.
Start building this workflow
Install the required MCPs from the directory and automate this in 10 min setup.
$ mcpizy install supabase && mcpizy install github
Free to install. Connect your accounts and this workflow runs itself.