Changing only an FK's onDelete is detected but never applied
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
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
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.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Nimblesite/DataProvider
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Nimblesite/DataProvider#72 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
Nimblesite/DataProvider#109 · 2 bình luận ·
-
A check constraint the schema cannot name can never be retired, and keeps enforcing the old ruleĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Nimblesite/DataProvider#107 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
Nimblesite/DataProvider#106 ·
-
migrate --allow-destructive drops EVERY foreign key when the database already matches the schemaĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
Nimblesite/DataProvider#105 · 5 bình luận ·
Tất cả issue của Nimblesite/DataProvider
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
ClickHouse/clickhouse-cs#639 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
ifpebj-ti/controle-acesso-veiculos#377 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Money ExploitsĐang mởS: Untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
project-wayfarer/wayfarer-14#1628 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
:watch: Not Triaged dotnet-target-version
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày