UPDATE uploaded_files LEFT JOIN borrowers on uploaded_files.owner=borrowers.borrowernumber SET owner=NULL WHERE borrowers.borrowernumber IS NULL;
ALTER TABLE uploaded_files ADD FOREIGN KEY (owner) REFERENCES borrowers (borrowernumber) ON DELETE SET NULL ON UPDATE CASCADE;
owner int(11),
public tinyint,
permanent tinyint,
PRIMARY KEY (id)
PRIMARY KEY (id),
CONSTRAINT `uploaded_files_ibfk_1` FOREIGN KEY (`owner`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-