feat(cli): add declarative schema apply command#5694
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 18966bf66e
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6c405ae87e
ℹ️ 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".
There was a problem hiding this comment.
Preserve pg-delta diagnostics on Go apply failures
When the newly registered Go apply path reaches this call and pg-delta returns a structured non-success status, pgdelta.ApplyDeclarative still returns immediately from RunEdgeRuntimeScript on the script's forced non-zero exit before unmarshalling stdout (apps/cli-go/internal/pgdelta/apply.go). Fresh evidence: this line is the new public entry point to that helper. Invalid declarative schemas therefore show only the generic container error instead of the formatted errors, stuck statements, or validation output.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Return a success payload for JSON output modes
When users run this new native command with --output-format json or --output-format stream-json, the success path only writes human text to stderr and then returns, so stdout is empty instead of a machine-readable success/result event. Other native legacy handlers branch on output.format and call output.success(...); without that here, scripted callers that opt into the global JSON modes cannot reliably detect a successful apply from stdout.
Useful? React with 👍 / 👎.

Summary
Adds
supabase db schema declarative applyfor applying existing declarative schema files directly to the local database via pg-delta.This keeps the flow separate from timestamped migrations: it starts the local database when needed, mounts the configured declarative schema directory read-only, runs the pg-delta apply script, and leaves migration files/history untouched. The PR also wires the Go command surface, adds regression coverage, and documents the native legacy side effects.
Closes #5204.