fix: mark only the referenced table PK in the DWH stub

This commit is contained in:
2026-08-11 19:43:25 +02:00
parent c44b70e77e
commit f00cc289d8
+3 -3
View File
@@ -566,9 +566,9 @@ async function startServers(ctx) {
column,
type: inferColumnType(first[column]),
nullable: false,
// `patient_id` is marked as a primary key so the same-name FK heuristic can discover
// joins from every table that carries it, giving the full-run FK checkpoint candidates.
pk: column === "id" || column === "patient_id",
// Only the referenced table marks `patient_id` as primary, so the SQL miner sees a
// PK/non-PK pair while the same-name heuristic still discovers joins from the others.
pk: column === "id" || (table === "patients" && column === "patient_id"),
default: null,
})));
return;