Changing only an FK's onDelete is detected but never applied
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
Línea de trabajo
Read docs/reports/dataprovider-migrate-defects.md for the reproduction details, then trace the migration planner path that compares foreign-key definitions and the integrity-check failure described here. Identify why an onDelete/onUpdate-only difference produces no operation, and verify that only the affected constraint is swapped and the integrity check passes without --allow-destructive.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
Changing only an FK's onDelete (or onUpdate) in the schema is detected but never applied. The migrator emits no operation for it, reports success, then fails its own integrity check. There is no non-destructive way to change a delete rule.
Found by TradiSite rehearsing a production migration; version 0.9.12-beta on postgres:17.
Reproduction
Change one FK's action in the YAML — here usage_tracking.site_id, onDelete: Cascade → onDelete: SetNull — and migrate:
Phase: all — applying 2 of 2 operation(s):
DropCheckConstraintOperation
AddCheckConstraintOperation
Migration completed successfully
SCHEMA INTEGRITY CHECK FAILED
public.usage_tracking: foreign key FK_public.usage_tracking_site_id on delete expected SetNull but found Cascade
Exit code 1. The integrity checker knows exactly what differs; the planner produces nothing to fix it. Note also that the run prints Migration completed successfully immediately before failing, so a caller grepping for success sees success.
Why it matters
A delete rule is often the whole point of the change. TradiSite's case is a billing log that must outlive the site it describes — Cascade erases usage when a site is deleted, SetNull keeps it. That is a correctness and audit property, not a cosmetic one, and today it cannot be changed on a live database.
The only escape is --allow-destructive, which on a converged database drops every foreign key and recreates none (#105). So the choice today is between a wrong delete rule and no referential integrity at all.
Fix wanted
Emit an AlterForeignKeyOperation — drop and re-add that one constraint — whenever only onDelete / onUpdate differs, without requiring --allow-destructive. It is a single constraint swap, not a destructive change to data.
Related: #105. Reproduction write-up: docs/reports/dataprovider-migrate-defects.md in the TradiSite repository.
- Lenguaje dominante
- C#
- Estrellas
- 67
- Forks
- 4
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
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 Nimblesite/DataProvider
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Nimblesite/DataProvider#72 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
Nimblesite/DataProvider#109 · 2 comentarios ·
-
A check constraint the schema cannot name can never be retired, and keeps enforcing the old ruleAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Nimblesite/DataProvider#107 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
Nimblesite/DataProvider#106 ·
-
migrate --allow-destructive drops EVERY foreign key when the database already matches the schemaAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
Nimblesite/DataProvider#105 · 5 comentarios ·
Todos los issues de Nimblesite/DataProvider
Issues similares
-
bug P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
nightscout/nocturne#1908 ·
Los mantenedores suelen responder en 1 día
-
bug documentation Needs: Triage :mag:
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
WPF: each page's `Title` overwrites the window title, and returning to a page does not restore itAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
agentic-workflows area/Docs partner/agentic-workflows
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
jamesmontemagno/tiny-clips#378 · 2 comentarios ·
Los mantenedores suelen responder en 1 día