migrate --allow-destructive drops EVERY foreign key when the database already matches the schema
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 52/100
Direzione di ricerca
Start with the DataProviderMigrate migrate --allow-destructive entry point and reproduce the issue against PostgreSQL 16 using the unchanged schema. Compare the destructive path with the additive path and inspect the integrity-check output. Done means a converged schema retains all 25 foreign keys, removes only undeclared structures, passes the integrity check, and remains idempotent.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
DataProviderMigrate migrate --allow-destructive run against a database that
is already converged with the supplied schema drops every foreign key in
the database, then fails its own integrity check listing the constraints it
just removed.
The schema is unchanged between runs. Nothing in it asks for a constraint to
be removed.
Reproduction
Postgres 16 in Docker, one unmodified schema file, nothing else touching the DB.
run 1 — additive (fresh database) -> 25 foreign keys, "Schema integrity check passed"
run 2 — additive (same schema) -> 25 foreign keys, passes # additive is idempotent
run 3 — destructive (same schema) -> 0 foreign keys, "SCHEMA INTEGRITY CHECK FAILED"
Verified separately that a destructive run against a fresh database is
fine (creates 25 and passes); it is the destructive run against an
already-migrated database that destroys them. So the failure is on exactly the
path an operator uses in production, where the database is always already
converged.
Count query:
SELECT count(*) FROM pg_constraint WHERE contype = 'f';
Output tail from the destructive run
Migration completed successfully
SCHEMA INTEGRITY CHECK FAILED
public.tenant_credit: missing foreign key FK_tenant_credit_tenant_id on (tenant_id)
public.tenant_members: missing foreign key FK_tenant_members_tenant_id on (tenant_id)
public.conversations: missing foreign key FK_conversations_config_id on (config_id)
public.messages: missing foreign key FK_messages_conversation_id on (conversation_id)
...23 more
"Migration completed successfully" is printed immediately before the integrity
check reports the damage, so a caller checking only that line sees success.
Impact
Severe, and aimed squarely at production. The consuming project's documented
migration procedure is: additive migrate, deploy the code, then
migrate --allow-destructive to drop what the schema no longer declares. That
final step is exactly the reproduction above, so following the intended
process strips the production database of all referential integrity while
reporting "Migration completed successfully".
Exit code is 1 and the constraints are already gone by then — the drop is not
rolled back when the integrity check fails.
Expected
A destructive migrate removes only the structure the schema no longer
declares. A schema that still declares all 25 foreign keys must leave all 25
in place, and the run must be idempotent, exactly as the additive path already is.
- Lingua principale
- C#
- Stelle
- 67
- Fork
- 4
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Nimblesite/DataProvider
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Nimblesite/DataProvider#72 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
Nimblesite/DataProvider#108 ·
-
A check constraint the schema cannot name can never be retired, and keeps enforcing the old ruleAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
Nimblesite/DataProvider#107 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
Nimblesite/DataProvider#106 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
Nimblesite/DataProvider#104 ·
Tutte le issue di Nimblesite/DataProvider
Issue simili
-
go 🏃 testing 🧪
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
valkey-io/valkey-glide#7239 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
SubtitleEdit/subtitleedit#15462 ·
I maintainer di solito rispondono entro 1 giorno
-
:watch: Not Triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
comp:instrumentation.aspnetcore
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
open-telemetry/opentelemetry-dotnet-contrib#5427 ·
I maintainer di solito rispondono entro 1 giorno
-
[feature request] Condier making `TelemetrySpan`'s constructor and `Activity` property publicApertaenhancement needs-triage pkg:OpenTelemetry
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
open-telemetry/opentelemetry-dotnet#7851 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno