fix(cli): clarify db diff help for the migra declarative target
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 1/5
- Tiempo estimado
- Menos de una hora
- Aptitud para principiantes
- 88/100
- Tipo de issue
- Documentación
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- postgresql, typescript
- Área
- cli, databases, documentation
Línea de trabajo
Comienza en apps/cli/src/commands/db/diff/diff.command.ts y compara su texto de ayuda con el manejo de la sobrescritura del destino en apps/cli/src/commands/db/shared/shadow-source.ts y diff.handler.ts. Verifica que la descripción distinga entre el destino de base de datos en vivo de pg-delta y el destino de declaración local legacy de migra. Se considera terminado cuando la ayuda explica ambos casos y el fixture existente de solo declaración para un stack detenido sigue generando la migración esperada.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 2.4k
- Forks
- 533
- Merge medio
- 21 h 24 min
- PR fusionados (30 d)
- 378
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de supabase/cli
-
🐛 Bug supabase/cli
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
db schema declarative sync: no way to fail (non-zero exit) when the generated migration is destructiveQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto✨ Feature supabase/cli
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
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 requestPosiblemente ocupada @7ttp la tomó hace 13 días. Abierto🐛 Bug supabase/cli
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
supabase/cli#6975 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Migration error caret is missing or misplaced when the statement contains multibyte charactersAbierto🐛 Bug supabase/cli
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
🐛 Bug supabase/cli
Dificultad 3/5 1-2 días Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día
Todos los issues de supabase/cli
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
agilepathway/label-checker#739 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
-
Wrong key location at startupAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
CopilotKit/OpenBot#800 ·
Los mantenedores suelen responder en 1 día
-
Endpoint links in the tag operations list are below the 24px target sizePosiblemente ocupada @AdzerKI la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
ehmpathy/rhachet-roles-bhuild#471 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
Los mantenedores suelen responder en 1 día