Open miqrogroove opened 6 months ago
We've seen this before where there are foreign keys preventing this deletion. Take a look in the database to see if there's anywhere those representations are being used (either a parent representation or maybe one of the ca_{tablename}_x_object_representations). Do a query to find out what the id's of the deleted representations are. (SELECT representation_id FROM ca_object_representations WHERE deleted
).
@kehh Does that imply my object representations can't be deleted unless the object is also deleted? That would be... highly inconvenient.
Foreign key constraints are a likely issue. I've traced the silent failure as far as
And I was going to try to pull the codes next.
'opn_error_number' => 250,
'ops_error_description' => 'Invalid relationship reference for representation_id',
'ops_error_context' => 'Db->mysqli->execute()',
Here's the same query sent straight to the mysql client:
mysql> DELETE FROM ca_object_representations WHERE representation_id = 5773;
ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`providence`.`ca_download_log`, CONSTRAINT `fk_ca_download_log_representation_id` FOREIGN KEY (`representation_id`) REFERENCES `ca_object_representations` (`representation_id`) ON DELETE RESTR)
Good lord. So now I can't delete anything that has ever been downloaded? Is there no code to handle this?
Purge the download log and delete whatever you want. Please keep in mind this is software for archival usage. For most users permanently deleting things is not desirable, especially if those things been interacted with (eg. downloaded).
Got it but gee whiz. I'm trying to replace some representations and occasionally things get uploaded in error. Is this not a bug where I have to truncate a table to get the caUtils purge command to work as expected?
I'm getting this same output everytime I run caUtils purge-deleted:
Those 52 representations and their associated media files aren't going away.