Skip to content

fix(cli): detect stale local postgres before declarative sync - #5646

Merged
jgoux merged 7 commits into
supabase:developfrom
pjpjq:codex/check-stale-local-postgres
Jun 25, 2026
Merged

fix(cli): detect stale local postgres before declarative sync#5646
jgoux merged 7 commits into
supabase:developfrom
pjpjq:codex/check-stale-local-postgres

Conversation

@pjpjq

Copy link
Copy Markdown
Contributor

What

  • Add a declarative schema sync guard that inspects the local Postgres container image tag before generating a migration.
  • Fail with an actionable stop/start suggestion when the running local Postgres container tag is stale.
  • Cover missing, matching, registry-different, and stale local container cases with regression tests.

Why

A stale local Postgres container after a CLI upgrade can produce declarative sync output against an inconsistent local stack, such as incorrect extension drops.

Validation

  • cd apps/cli-go && go test ./cmd ./internal/db/declarative
  • cd apps/cli-go && GOMAXPROCS=4 go test ./...
  • git diff --check

Fixes#5555

@pjpjq
pjpjq requested a review from a team as a code ownerJune 22, 2026 10:31
@jgoux
jgouxforce-pushed the codex/check-stale-local-postgres branch from 37bc9c7 to 5ffbf4bCompareJune 25, 2026 08:38
@jgoux

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit:afd3794c91

ℹ️ 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".

Comment threadapps/cli-go/cmd/db_schema_declarative.go Outdated
Comment threadapps/cli-go/cmd/db_schema_declarative.go Outdated
Comment threadapps/cli-go/cmd/db_schema_declarative.go

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit:2483ce8405

ℹ️ 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".

Comment threadapps/cli/src/legacy/commands/db/schema/declarative/sync/sync.handler.ts Outdated
Comment threadapps/cli/src/legacy/commands/db/shared/legacy-pgdelta.seam.layer.ts Outdated

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit:b24e45886b

ℹ️ 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".

Comment threadapps/cli-go/cmd/db_schema_declarative.go Outdated
Comment threadapps/cli/src/legacy/commands/db/schema/declarative/sync/sync.handler.ts Outdated
Comment threadapps/cli/src/legacy/commands/db/shared/legacy-pgdelta.seam.layer.ts Outdated

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit:bee148c014

ℹ️ 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".

Comment threadapps/cli-go/cmd/db_schema_declarative.go Outdated
Comment threadapps/cli/src/legacy/commands/db/schema/declarative/sync/sync.handler.ts Outdated

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit:ff19713dee

ℹ️ 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".

Comment threadapps/cli/src/legacy/commands/db/schema/declarative/sync/sync.handler.ts Outdated

@jgouxjgoux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! 🙏

@jgoux
jgoux enabled auto-merge June 25, 2026 14:06
@jgoux
jgoux added this pull request to the merge queueJun 25, 2026
Merged via the queue into supabase:develop with commit 229493cJun 25, 2026
34 of 35 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI does not detect stale local Postgres container version before declarative schema sync

2 participants

@pjpjq@jgoux