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

Đang mở
#71 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
65/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
csharp
Lĩnh vực
database

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
C#
Star
68
Fork
4
Merge trung bình
50 phút
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Nimblesite/DataProvider

Tất cả issue của Nimblesite/DataProvider

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.