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

Aperta
#71 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à
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
csharp
Ambito
database

Direzione di ricerca

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.

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

Descrizione

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.

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.