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.
Summary
Unrecognized
type:andonDelete:tokens in a schema YAML are silently coerced toText/NoActionwith 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
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
migratereports success and the integrity check passes, butidistext(notuuid) and the FK isNO ACTION(notCASCADE).Impact
Silent schema corruption from a single-character typo: a
uuid/json/timestamptzcolumn quietly becomestext; 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 loudwarnlog naming the offending token and column. Defaulting toText/NoActionshould never be silent.