Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Changing only an FK's onDelete is detected but never applied

Abierto
#108 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
55/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
csharp, postgresql
Área
databases

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

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Nimblesite/DataProvider

Todos los issues de Nimblesite/DataProvider

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.