Closed flenny closed 1 month ago
SQL statement to use to delete outdated borehole_files
records.
DELETE FROM bdms.borehole_files
WHERE (id_fil_fk, id_bho_fk) IN (
SELECT id_fil_fk, id_bho_fk FROM bdms.borehole_files
WHERE
id_fil_fk NOT IN (SELECT id_fil FROM bdms.files) OR
id_bho_fk NOT IN (SELECT id_bho FROM bdms.borehole))
Executed on... DEV 202406240915 INT 202406251323 PROD 202406271254
As mentionend in #1044 there are a bunch of outdated records in the _boreholefiles and files table due to missing foreign key constraints.