fix(cli): clarify db diff help for the migra declarative target
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức phù hợp với người mới
- 88/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- postgresql, typescript
- Lĩnh vực
- cli, databases, documentation
Hướng nghiên cứu
Bắt đầu từ apps/cli/src/commands/db/diff/diff.command.ts và so sánh nội dung trợ giúp của nó với cách xử lý override target trong apps/cli/src/commands/db/shared/shadow-source.ts và diff.handler.ts. Xác minh rằng phần mô tả phân biệt target cơ sở dữ liệu đang hoạt động của pg-delta với target khai báo legacy cục bộ của migra. Hoàn thành khi nội dung trợ giúp giải thích cả hai trường hợp và fixture chỉ khai báo hiện có của stack đã dừng vẫn tạo ra migration như mong đợi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
The generic db diff description says the command compares migrations with a live database, but --local --use-migra can compare migrations with a target built from declared SQL instead. That supported branch works with the local stack stopped. The help does not name this exception, so it gives legacy declarative projects the wrong comparison model.
This is an incorrect command description, not a request to change the schema-diff engine or migration behavior. The statement that declarative files are not the migrations baseline is accurate for the source side. The missing distinction is that migra can use those files for the target side.
Steps to reproduce
- Use the published npm package
[email protected]through the installed project runner. Runnpm exec -- supabase db diff --helpand read the description quoted below. - In an isolated local Docker project, retain
[experimental.pgdelta] enabled = falseand set[db.migrations] schema_paths = ["./schemas/*.sql"]. Leave generic experimental and engine/runtime environment overrides unset. - Put the following initial definition in one versioned migration and in
supabase/schemas/catalog.sql. Start the local project once and verify the initial table exists.
create table public.catalog (
id bigint generated always as identity primary key,
label text not null
);
- Stop only that local project with
npm exec -- supabase stop. Change only the declaration to the following definition, leaving migration history unchanged.
create table public.catalog (
id bigint generated always as identity primary key,
label text not null,
category text
);
- With the local stack still stopped, run
npm exec -- supabase db diff --local --use-migra -f add_catalog_categoryand inspect the emitted migration.
The executed fixture used these steps with a database-only Docker stack. It generated the declaration-only change successfully. The defect can also be inspected without Docker by comparing the command description with the linked declared-target branch.
Expected behavior
The help distinguishes the migrations source from the selected target. It explains that pg-delta normal diff uses the live selected database, while a local migra diff can build its target from configured declarations. It should let a legacy declarative-project user understand why a stopped-stack diff can generate a change that was never applied to the live database.
The closure signal is that help accurately describes both cases and the existing declaration-only fixture still produces the expected migration without requiring a running local database. There is no request to change either engine's comparison behavior.
Actual behavior
The description reads:
Compares a shadow built from supabase/migrations with a live database (--local by default, --linked, or --db-url). Declarative files under supabase/schemas are not part of this baseline.
In the stopped legacy fixture, db diff --local --use-migra -f add_catalog_category exited 0, selected engine=migra, and generated:
alter table "public"."catalog" add column "category" text;
That column existed only in the declaration at diff time. After restart and local application, an explicit local reset replayed both migrations successfully. A second stopped migra diff returned No schema changes found and wrote no migration. These results establish that the declaration target worked; the command description omitted it.
Affected area
Database / Migrations command help. Documentation issue type: incorrect documentation. The description is in apps/cli/src/commands/db/diff/diff.command.ts; the supported target override is in apps/cli/src/commands/db/shared/shadow-source.ts and its consumer in diff.handler.ts.
Runtime or environment
- Supabase CLI 2.119.0, installed as a project-local npm dependency.
- Node.js 22.23.2 and npm 12.0.2.
- macOS arm64 host with Docker Engine 29.8.0, Linux arm64 containers, and PostgreSQL 17.11.
- Legacy migra configuration, pg-delta disabled, no generic experimental flag, and no engine/runtime environment overrides.
Evidence
- The tested release source is
v2.119.0, commit3cb948c5a70d31fbcb0fd1dcc616ee196a125cd0. - The fetched default branch is
developat66ccc6f63a9a26b29c368698994a0843d23b80be. Its command description retains the same text. - At that current revision, shadow-source.ts loads declared schemas for a local legacy target and creates
targetUrlOverride. The diff handler consumes that override. - Merged PR #6920 explicitly retains
contrib_regressionfor migra because it is the declarative diff target. - All 20 commits from the tested release source to the fetched default SHA were reviewed, together with the complete live open corpus of 80 issues and pull requests and relevant closed issues and merged PRs. No matching command-help report or fix was found. Closed issue #3827 concerns a stopped-stack connection failure in an older release, rather than the successful migra branch and misleading help reported here.
Current-source status comes from source inspection. The executed Docker workflow was against published CLI 2.119.0; the current default revision was not built or executed for this report.
Impact
Users and agents who follow command help cannot tell whether a local migra diff reads their running database or their declarations. They may dismiss a supported declaration workflow or attribute its generated migration to live database changes. Naming the engine-specific target restores a reliable command description.
- Ngôn ngữ chính
- TypeScript
- Star
- 2.4k
- Fork
- 533
- Merge trung bình
- 21 giờ 49 phút
- Pull request đã merge (30 ngày)
- 371
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của supabase/cli
-
🐛 Bug supabase/cli
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
db schema declarative sync: no way to fail (non-zero exit) when the generated migration is destructiveCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở✨ Feature supabase/cli
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
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 requestCó thể đã có người làm @7ttp đã nhận 13 ngày trước. Đang mở🐛 Bug supabase/cli
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
supabase/cli#6975 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Migration error caret is missing or misplaced when the statement contains multibyte charactersĐang mở🐛 Bug supabase/cli
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Scoped tokens: supabase link needs API Key Secrets even though db push only needs the DB passwordĐang mở🐛 Bug supabase/cli
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Add: Yemen Education SDĐang mởstreams:add
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
apache/rocketmq-dashboard#6872 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
interledger/publisher-tools#931 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
ARTPARK-SAHAI-ORG/calibrate-frontend#727 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
fab-geocommuns/RNB-site#539 ·
Maintainer thường phản hồi trong vòng 2 ngày