• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / cli / 27149724318

08 Jun 2026 03:51PM UTC coverage: 64.314% (+0.3%) from 64.023%
27149724318

push

github

web-flow
fix(cli): skip pg_dump in db pull when using pg-delta diff engine (#5255)

## What

Switches `supabase db pull --diff-engine pg-delta` to drive its initial
pull from pg-delta's catalog diff instead of `pg_dump`, and lands the
supporting plumbing (remote TLS handling, debug bundles, and a local
pg-delta dev workflow) needed to make that path reliable against Cloud.

Closes CLI-1472.

## Why

The legacy initial-pull pipeline is `pg_dump` → restore into a local
shadow → diff. That round-trip silently destroys ownership for any
object the local `postgres` role can't assume: `pg_dump` emits `ALTER
... OWNER TO supabase_admin` (etc.), the restore runs as a non-superuser
so the owner is dropped, and every restored object then reports `owner =
postgres`. pg-delta's supabase integration filter drops platform-managed
objects by `owner ∈ SUPABASE_SYSTEM_ROLES`, so once the owner signal is
gone those objects leak into the user's migration file and break
`supabase db reset` (CLI-1469 FDW ACLs, CLI-1470 Wasm wrappers).

pg-delta already speaks `pg_catalog` directly via `extractCatalog`,
preserving ownership, so diffing the remote catalog against an empty
shadow produces a clean initial migration without `pg_dump` in the loop.

## What changed

### Initial-pull routing
- `db pull` no longer runs `dumpRemoteSchema` on the initial pull when
the pg-delta diff engine is selected; the shadow diff is the sole
producer of the migration file (`internal/db/pull/pull.go`,
`cmd/db.go`).
- `shouldUseDeclarativePgDeltaPull` makes explicit `--diff-engine
pg-delta` keep the migration-file workflow even when
`[experimental.pgdelta] enabled = true` would otherwise default to the
declarative export path.
- New `swallowInitialInSync` / `ensureMigrationWritten` helpers
distinguish "pg-delta produced no statements" from "pg_dump already
wrote content", so an empty pg-delta result still surfaces `No schema
changes found` correctly.

### Diff plumbing
- `DiffDatabase` now returns a `Datab... (continued)

10386 of 16149 relevant lines covered (64.31%)

7.07 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

54.55
/internal/db/diff/diff.go


Source Not Available

The file "internal/db/diff/diff.go" isn't available on github. Either it's been removed, or the repo root directory needs to be updated.

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc