feat(cli): enable pg-delta by default for new projects#5511
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9ca7ba83d4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Supabase CLI previewnpx --yes https://pkg.pr.new/supabase@5511Preview package for commit |
Coverage Report for CI Build 27208348653Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage increased (+0.2%) to 64.547%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions235 previously-covered lines in 3 files lost coverage.
Coverage Stats
💛 - Coveralls |
Reapply PR #5511 on current develop after resolving unrelated-history conflicts. Scope pg-delta init default to supabase init/bootstrap only, keep db pull on migration output with config-driven shadow diff engine, honor explicit --use-migra for db diff, keep db remote commit on migration files, and extend the TS/JSON config schema with pgdelta.
1e4b018 to
80b2d7f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 80b2d7f559
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
db diff resolved useDelta from the config-driven default and only let --use-migra override it. In a pg-delta-enabled project, --use-pg-schema (or --use-pgadmin) selected its differ but left useDelta true, so diff.Run still ran pg-delta declarative shadow setup and the PGDELTA_DEBUG path. Extract resolveDiffEngine so any explicit non-delta engine clears pg-delta mode, and cover it with unit tests. Also reflow go-cli-porting-status.md to satisfy oxfmt. https://claude.ai/code/session_014k7CJwuyg5BBeQxTHHWWJY
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ff09fd2deb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Restore the auto_expose_new_tables comment block to the develop wording in both the Go config template and the TS init template; a rebase had reverted it to an older revision. - Make the deprecated --use-pg-delta pull flag guide users to "--declarative with [experimental.pgdelta] enabled = true", in both the Go cobra deprecation message and the TS flag description. https://claude.ai/code/session_014k7CJwuyg5BBeQxTHHWWJY
Hardcode [experimental.pgdelta] enabled = true in the config template instead of gating it behind an init-only flag. Because mergeDefaultValues ejects the template as the default layer, this makes pg-delta the active engine for every project that does not explicitly opt out, not just newly generated ones. Drop the PgDeltaInitEnabled flag and the InitParams UsePgDelta plumbing in init and bootstrap. Disable pg-delta in the db start / start test suites: catalog caching shells out to a subprocess that cannot use the in-process pgmock dialer, and those suites cover container/schema startup rather than caching. https://claude.ai/code/session_014k7CJwuyg5BBeQxTHHWWJY
This reverts commit 6c73392.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6c73392384
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
First non-breaking step of CLI-1586 toward making pg-delta the default diff engine. New projects opt into pg-delta, and
db pullnow lets the configured engine drive its shadow diff. Existing projects are unaffected.New projects default to pg-delta (CLI-1587)
supabase initnow scaffoldsconfig.tomlwith[experimental.pgdelta] enabled = true. The global default for an absent/undefined section stays migra, so existing projects are untouched andenabled = falseremains a one-line rollback.The Go config template doubles as the source of programmatic defaults via
mergeDefaultValues(it ejects the same template), so literally enabling pg-delta in the template would have flipped the default for every existing config. To keep this non-breaking, theenabledvalue is templated from an init-only flagPgDeltaInitEnabled:InitConfigsets it fromInitParams.UsePgDelta, which is opted in only by thesupabase initcommand andbootstrap. OtherInitConfigcallers — including theWriteConfigtest helper — leave itfalse, so they keep producing migra-default configs.falsewhenEjectfeedsmergeDefaultValues, so configs without the section keep resolving to migra.Scoping the opt-in to the command (rather than unconditionally inside
InitConfig) keeps the generated default from leaking into the globalutils.Configduring tests that scaffold a config, which would otherwise change unrelateddb startbehavior.The TS init template (
project-init.templates.ts) writesenabled = truedirectly and stays byte-aligned with the Go scaffold (enforced by the existing parity test).db pullengine resolutionWhen pg-delta is enabled (config or
EXPERIMENTAL_PG_DELTA),supabase db pullkeeps its migration-file workflow but defaults the shadow diff engine to pg-delta instead of migra. Specifically:db pullto declarative output.resolvePullDiffEngine.--diff-engine migra(orenabled = false) is an authoritative rollback that overrides the config default.--declarativeflag;--use-pg-deltais kept as a deprecated alias whose message guides users to--declarativewith[experimental.pgdelta] enabled = true.db diffengine resolutionresolveDiffEngine(unit-tested) centralizes the decision: the config default applies unless an explicit non-pg-delta engine flag (--use-migra,--use-pgadmin,--use-pg-schema) is selected, which clears pg-delta mode sodiff.Runskips pg-delta-specific declarative shadow setup and thePGDELTA_DEBUGpath. The deprecateddb remote commitis intentionally left unchanged.Notes for reviewers
PgDeltaInitEnabledistoml:"-" json:"-", so it is never parsed from or serialized to config files — it only feeds template rendering.--diff-engineflag is optional and only forwarded when set, so the Go config-driven default applies when omitted; no TS behavior change was needed.--declarative/--use-pg-deltaare mutually exclusive with--diff-engine.auto_expose_new_tablestemplate comment to the develop wording after a rebase had reverted it.db diff/db pullreference pages and the pullSIDE_EFFECTS.md.Closes CLI-1587
https://claude.ai/code/session_014k7CJwuyg5BBeQxTHHWWJY