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

オープン
#68 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
csharp, sql
領域
database, tooling

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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]).

主要言語
C#
スター
68
フォーク
4
平均マージ
50分
マージ済み PR(30日)
2

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Nimblesite/DataProvider のほかの issue

Nimblesite/DataProvider の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。