DataProviderMigrate: legacy/extra FK on a managed table is neither dropped nor reported — broke all prod inserts

Đang mở
#68 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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/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, sql
Lĩnh vực
database, tooling

Hướng nghiên cứu

No files or tests are named. Start by locating the integrity verifier and migration planner, then reproduce a managed table with an undeclared foreign key based on the public.sites scenario. Done means the extra constraint is reported and/or safely handled by an explicitly defined pruning behavior, with coverage for the failure case.

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

Mô tả

Version: dataprovidermigrate 0.9.12-beta (dotnet tool)

Scenario (TradiSite prod): public.sites is declared in schema.yaml with exactly ONE foreign key (org_id -> orgs). The live DB additionally had a legacy FK_sites_user_id FOREIGN KEY (user_id) REFERENCES public.users(id) left over from an old schema generation (public.users itself is no longer in the YAML at all).

Actual: DataProviderMigrate reports Migration completed successfully and the schema integrity check does not mention the extra FK at all. The stale constraint stayed in place and made every INSERT INTO sites fail with 23503 FK_sites_user_id — a hard prod outage (every new-user site creation 500'd), invisible to the migration tooling.

Expected (either is fine, both is best):

  1. The integrity verifier should report extra/undeclared foreign keys on tables it manages, not just missing/mismatched ones; and/or
  2. The planner should drop constraints on managed tables that are absent from the declared schema (perhaps behind a --prune-constraints flag).

A tool that owns a table's DDL but silently tolerates undeclared constraints on it cannot be trusted as the single source of truth for that table.

Workaround used: manual ALTER TABLE public.sites DROP CONSTRAINT "FK_sites_user_id" (+ dropped the orphaned public.users table) via psql.

Found while operating TradiSite prod (MelbourneDeveloper/TradiSite, spec [DB-MIGRATE-CLI-ONLY]).

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.