fix(cli): detect stale local postgres before declarative sync by pjpjq · Pull Request #5646 · supabase/cli · GitHub
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

@pjpjq pjpjq commented Jun 22, 2026

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 owner June 22, 2026 10:31
@jgoux jgoux force-pushed the codex/check-stale-local-postgres branch from 37bc9c7 to 5ffbf4b Compare June 25, 2026 08:38
@jgoux

jgoux commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot 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 thread apps/cli-go/cmd/db_schema_declarative.go Outdated
Comment thread apps/cli-go/cmd/db_schema_declarative.go Outdated
Comment thread apps/cli-go/cmd/db_schema_declarative.go

@chatgpt-codex-connector chatgpt-codex-connector Bot 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 thread apps/cli/src/legacy/commands/db/schema/declarative/sync/sync.handler.ts Outdated
Comment thread apps/cli/src/legacy/commands/db/shared/legacy-pgdelta.seam.layer.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot 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 thread apps/cli-go/cmd/db_schema_declarative.go Outdated
Comment thread apps/cli/src/legacy/commands/db/schema/declarative/sync/sync.handler.ts Outdated
Comment thread apps/cli/src/legacy/commands/db/shared/legacy-pgdelta.seam.layer.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot 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 thread apps/cli-go/cmd/db_schema_declarative.go Outdated
Comment thread apps/cli/src/legacy/commands/db/schema/declarative/generate/generate.handler.ts Outdated
Comment thread apps/cli/src/legacy/commands/db/schema/declarative/sync/sync.handler.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot 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 thread apps/cli/src/legacy/commands/db/schema/declarative/sync/sync.handler.ts Outdated

@jgoux jgoux 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 queue Jun 25, 2026
Merged via the queue into supabase:develop with commit 229493c Jun 25, 2026
34 of 35 checks passed
Sign up for free to 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