Uhm. No. I think you really do need to chug through all entries. 'on
delete cascade' would only delete the records for which the record
with primary-key that is referenced gets deleted. I could drop the
general_comments table, and leave all the acs_messaging & acs_object
records intact. I would consider those dangling objects. It might be
wise to create 'on delete' triggers for all tables... We are not using
the object-oriented features of the DB, so it doesn't know about the
relations.
Anyway, this is whats in general-comments-drop.sql (for postgres):
create function inline_0 ()
returns integer as '
declare
comment_rec RECORD;
begin
FOR comment_rec IN select comment_id from general_comments LOOP
-- There is a bug in content_item.delete that results in
-- referential integrity violations when deleting a content
-- item that has an image attachment. This is a temporary fix
-- until ACS 4.1 is released.
delete from images
where image_id in (select latest_revision
from cr_items
where parent_id = comment_rec.comment_id);
perform acs_message__delete(comment_rec.comment_id);
END LOOP;
return 0;
end;' language 'plpgsql';
select inline_0 ();
Does anybody (Dan?) know whether or not I still need to do the
explicit deletion of images?