Bug: unknown column-type / onDelete tokens silently fall back to Text / NoAction (no validation) — typos corrupt the schema

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

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
65/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
csharp
Área
database

Línea de trabajo

Start in Migration/Nimblesite.DataProvider.Migration.Core/SchemaYamlSerializer.cs, reading ParseType(...) and ForeignKeyActionYamlConverter.ReadYaml(...), where unknown tokens currently fall back silently. Trace how parse failures or warnings are reported, then verify that invalid type and onDelete tokens name the offending value and do not produce a successful migration with Text or NoAction.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Summary

Unrecognized type: and onDelete: tokens in a schema YAML are silently coerced to Text / NoAction with no error or warning. A typo therefore produces a silently-wrong schema that still "migrates successfully" and passes the post-apply integrity check (because both the desired and actual sides agree on the wrong type).

Environment

  • v0.9.12-beta (commit 8e3af36)

Details

In Migration/Nimblesite.DataProvider.Migration.Core/SchemaYamlSerializer.cs:

  • ParseType(...) ends both the parameterized and the simple switch with _ => new TextType() (≈ lines 221 and 249).
  • ForeignKeyActionYamlConverter.ReadYaml(...) ends with _ => ForeignKeyAction.NoAction (≈ line 302).

Repro

- { name: id, type: Uuidd, isNullable: false }          # typo -> column created as TEXT, no error
foreignKeys:
  - { columns: [parent_id], referencedTable: t, referencedColumns: [id], onDelete: Cascadee }  # typo -> NO ACTION

migrate reports success and the integrity check passes, but id is text (not uuid) and the FK is NO ACTION (not CASCADE).

Impact

Silent schema corruption from a single-character typo: a uuid/json/timestamptz column quietly becomes text; a cascade/set-null FK quietly becomes no-action. The "integrity check passed" message gives false confidence.

Suggested fix

Reject an unrecognized token (return a MigrationError / throw a parse error), or at minimum emit a loud warn log naming the offending token and column. Defaulting to Text/NoAction should never be silent.

Lenguaje dominante
C#
Estrellas
68
Forks
4
Merge medio
50 min
PR fusionados (30 d)
2

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

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.