📄 SKILL.md

← Vault

name: supabase-cloud-migrations-vps-deploy

description: Deploy Supabase Cloud migrations from VPS when supabase db push fails on "already exists" and CLI connects to local Docker instead of remote

category: supabase


Supabase Cloud Migrations — VPS Deploy Workaround

Context

When deploying a Supabase Cloud project to VPS using supabase db push, two critical non-obvious behaviors must be understood:

1. supabase db push connects to LOCAL Docker Postgres, NOT the remote Cloud database — even after supabase link succeeds.

2. There is NO --force or --skip-existing flag in supabase db push.

3. Service role key fails (401/403) for management API — Cloudflare blocks direct management calls.

4. If a migration statement fails, ALL remaining migrations are skipped — no partial progress.

Workflow

Step 1 — Link the project

`bash

supabase login # with Management API token (sbp_...)

supabase link --project-ref

`

Step 2 — Attempt migration push

`bash

supabase db push

`

Verification

After migrations, verify all expected tables exist via REST API:

`bash

curl -s "https://.supabase.co/rest/v1/

?select=id&limit=1" \

-H "apikey: " \

-H "Authorization: Bearer "

`