Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Changing only an FK's onDelete is detected but never applied

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

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

Đánh giá

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

Hướng nghiên cứu

Read docs/reports/dataprovider-migrate-defects.md for the reproduction details, then trace the migration planner path that compares foreign-key definitions and the integrity-check failure described here. Identify why an onDelete/onUpdate-only difference produces no operation, and verify that only the affected constraint is swapped and the integrity check passes without --allow-destructive.

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

Mô tả

Summary

Changing only an FK's onDelete (or onUpdate) in the schema is detected but never applied. The migrator emits no operation for it, reports success, then fails its own integrity check. There is no non-destructive way to change a delete rule.

Found by TradiSite rehearsing a production migration; version 0.9.12-beta on postgres:17.

Reproduction

Change one FK's action in the YAML — here usage_tracking.site_id, onDelete: Cascade → onDelete: SetNull — and migrate:

Phase: all — applying 2 of 2 operation(s):
  DropCheckConstraintOperation
  AddCheckConstraintOperation
Migration completed successfully
SCHEMA INTEGRITY CHECK FAILED
public.usage_tracking: foreign key FK_public.usage_tracking_site_id on delete expected SetNull but found Cascade

Exit code 1. The integrity checker knows exactly what differs; the planner produces nothing to fix it. Note also that the run prints Migration completed successfully immediately before failing, so a caller grepping for success sees success.

Why it matters

A delete rule is often the whole point of the change. TradiSite's case is a billing log that must outlive the site it describes — Cascade erases usage when a site is deleted, SetNull keeps it. That is a correctness and audit property, not a cosmetic one, and today it cannot be changed on a live database.

The only escape is --allow-destructive, which on a converged database drops every foreign key and recreates none (#105). So the choice today is between a wrong delete rule and no referential integrity at all.

Fix wanted

Emit an AlterForeignKeyOperation — drop and re-add that one constraint — whenever only onDelete / onUpdate differs, without requiring --allow-destructive. It is a single constraint swap, not a destructive change to data.

Related: #105. Reproduction write-up: docs/reports/dataprovider-migrate-defects.md in the TradiSite repository.

Ngôn ngữ chính
C#
Star
67
Fork
4
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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.