db schema declarative sync: no way to fail (non-zero exit) when the generated migration is destructive
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
- #7037 @milekv による — マージされずにクローズ
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 84/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- cli
調査の方向性
apps/cli/src/commands/db/schema/declarative/sync/sync.handler.ts:538-547 のポインタから開始し、そこで result.dropWarnings が出力される stderr を確認する。sync コマンドに対するフラグの宣言方法と、CLI の他の箇所で終了コードがどのように設定されているかを追跡する。コマンドがマイグレーションの書き込み前にゼロ以外の終了コードを返すように、--fail-on-destructive フラグ(可能であれば、警告の JSON 出力も)を追加する。issue の再現手順に従って検証し、フラグの有無の両方で echo "exit=$?" を確認し、sync ハンドラ周辺の既存のテストも探す。
索引モデルが issue の本文から書いたものです。
説明
Summary
supabase db schema declarative sync --no-apply prints Found destructive changes in schema diff. Please double check if these are expected: to stderr when the planned migration contains drops. It still writes the migration file and exits 0. CI jobs and scripted workflows cannot tell a destructive plan from a safe one without scraping the human-readable stderr text. --output-format json does not help either: this command prints no JSON.
Feature request: a flag such as --fail-on-destructive, or a distinct non-zero exit code, that makes sync fail when the plan contains destructive changes. Ideally the flag would also skip writing the migration file. Including the drop warnings in --output-format json would also help.
Environment
- Supabase CLI 2.119.0 (npm package, darwin-arm64), bundled
@supabase/pg-delta1.0.0-alpha.56 - Postgres 17.11 (
public.ecr.aws/supabase/postgres:17.11.0.002) - macOS 26 (Darwin 25.3.0, arm64)
Steps to reproduce
-
supabase init, then add one migration:CREATE TABLE public.d (id int); -
Run:
supabase start supabase db reset --local supabase db schema declarative generate --local --overwrite rm supabase/schemas/public/tables/d.sql supabase db schema declarative sync --no-apply; echo "exit=$?"
Expected
A supported way to make this run fail on a destructive plan, either through an opt-in flag or a dedicated exit code, so a pipeline can stop before a drop is committed.
Actual
Applying migration 20260101000007_table.sql...
Generated migration SQL:
DROP TABLE "public"."d";
Created new migration at supabase/migrations/20261006190533_declarative_sync.sql
Found destructive changes in schema diff. Please double check if these are expected:
DROP TABLE "public"."d"
exit=0
supabase db schema declarative sync --no-apply --output-format json gives the same plain-text output and also exits 0.
Impact
Sync runs unattended (in CI, a pre-commit check, or an agent loop) and sees exit code 0. A schema file that was deleted or moved by mistake therefore becomes a committed DROP TABLE migration without any gate. The warning already exists. It just cannot be acted on programmatically.
Pointer
In the v2.119.0 tag (c66274cc6dc278a9413a6b0f099367ce150555ac), apps/cli/src/commands/db/schema/declarative/sync/sync.handler.ts:538-547 prints result.dropWarnings to stderr after the migration file is written. Execution then continues to the apply decision, and nothing changes the exit status. result.dropWarnings already has the data a flag would need.
- 主要言語
- TypeScript
- スター
- 2.4k
- フォーク
- 531
- 平均マージ
- 1日 4時間
- マージ済み PR(30日)
- 346
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
supabase/cli のほかの issue
-
stack: the HTTP gateway closes idle keep-alive connections after 5 s, so a client whose event loop is blocked gets ECONNRESET (`fetch failed`) on its next request対応中かも @7ttp が 5 日前に担当しました。 オープン🐛 Bug supabase/cli
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
📘 Docs supabase/cli
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
supabase/cli#6974 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
🐛 Bug supabase/cli
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
config push sends [auth.sms] enable_confirmations un-negated as sms_autoconfirm, so hosted projects get the opposite of local対応中かも @7ttp が 2 日前に担当しました。 オープン🐛 Bug supabase/cli
メンテナーはふだん 1 日以内に返信
-
stack: gateway still opens a new upstream connection per request on 2.119.0 (exhausts ephemeral ports on macOS)対応中かも @rbSparky が今日担当しました。 オープン🐛 Bug open-for-contribution supabase/cli
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
supabase/cli#6987 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
Tenant
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
MTES-MCT/Dossier-Facile-Frontend#2061 ·
メンテナーはふだん 1 日以内に返信
-
area:frontend
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
interledger/publisher-tools#905 ·
メンテナーはふだん 1 日以内に返信
-
Add: Cbeebies PL SDオープンapproved check:passed streams:add
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
iptv-org/iptv#54525 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
DB-plane provider_chat_options.* is accepted by config set but never merged into the loaded config対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
area:web
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
praetorianer777/GoTome#178 ·
メンテナーはふだん 1 日以内に返信