Skip to content

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

Description

@MelbourneDeveloper

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions