fix: prune orphan constructeur links before orientation swap
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
-- Remove constructeur link rows that reference missing parents or constructeur records.
|
||||
-- This prevents foreign key violations when the orientation of the join tables is normalized.
|
||||
|
||||
DELETE FROM "_MachineConstructeurs"
|
||||
WHERE "A" NOT IN (SELECT "id" FROM "machines")
|
||||
OR "B" NOT IN (SELECT "id" FROM "constructeurs");
|
||||
|
||||
DELETE FROM "_ComposantConstructeurs"
|
||||
WHERE "A" NOT IN (SELECT "id" FROM "composants")
|
||||
OR "B" NOT IN (SELECT "id" FROM "constructeurs");
|
||||
|
||||
DELETE FROM "_PieceConstructeurs"
|
||||
WHERE "A" NOT IN (SELECT "id" FROM "pieces")
|
||||
OR "B" NOT IN (SELECT "id" FROM "constructeurs");
|
||||
Reference in New Issue
Block a user