DataProviderMigrate: legacy/extra FK on a managed table is neither dropped nor reported — broke all prod inserts

Aperta
#68 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
csharp, sql
Ambito
database, tooling

Direzione di ricerca

No files or tests are named. Start by locating the integrity verifier and migration planner, then reproduce a managed table with an undeclared foreign key based on the public.sites scenario. Done means the extra constraint is reported and/or safely handled by an explicitly defined pruning behavior, with coverage for the failure case.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Version: dataprovidermigrate 0.9.12-beta (dotnet tool)

Scenario (TradiSite prod): public.sites is declared in schema.yaml with exactly ONE foreign key (org_id -> orgs). The live DB additionally had a legacy FK_sites_user_id FOREIGN KEY (user_id) REFERENCES public.users(id) left over from an old schema generation (public.users itself is no longer in the YAML at all).

Actual: DataProviderMigrate reports Migration completed successfully and the schema integrity check does not mention the extra FK at all. The stale constraint stayed in place and made every INSERT INTO sites fail with 23503 FK_sites_user_id — a hard prod outage (every new-user site creation 500'd), invisible to the migration tooling.

Expected (either is fine, both is best):

  1. The integrity verifier should report extra/undeclared foreign keys on tables it manages, not just missing/mismatched ones; and/or
  2. The planner should drop constraints on managed tables that are absent from the declared schema (perhaps behind a --prune-constraints flag).

A tool that owns a table's DDL but silently tolerates undeclared constraints on it cannot be trusted as the single source of truth for that table.

Workaround used: manual ALTER TABLE public.sites DROP CONSTRAINT "FK_sites_user_id" (+ dropped the orphaned public.users table) via psql.

Found while operating TradiSite prod (MelbourneDeveloper/TradiSite, spec [DB-MIGRATE-CLI-ONLY]).

Lingua principale
C#
Stelle
68
Fork
4
Merge medio
50m
PR unite (30g)
2

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Nimblesite/DataProvider

Tutte le issue di Nimblesite/DataProvider

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.