Forum OpenACS Development: Re: Drop script for organizations
Also I wonder why you are calling acs_object__delete first and then organization__delete - normally the latter should take care of the necessary object deletion automatically, no?
And what's the difference between these two queries:
select object_id from acs_objects where object_type=''organizations''
select party_id from parties where party_id in (select organization_id from organizations)
If organization subclasses parties (why not groups btw?), then they should return the same, or what am I missing here?
For future reference, this is what I came up with. You were right about the acs_object__delete and then organization__delete. However, I used the former. I'm not sure if that's incorrect.
I believe you're right. The two queries returned the same thing.
I'm not totally sure why Jon chose to use parties vs. groups. I don't really know what the tradeoffs are. I stayed with his choice. (docs on this are at http://openacs.org/doc/openacs-4-6-3/parties.html.
Anyway, here is what I have now:
-- @cvs-id $Id$ select drop_package('organization'); -- drop permissions delete from acs_permissions where object_id in (select organization_id from organizations); -- drop objects create function inline_0 () returns integer as ' declare object_rec record; begin for object_rec in select object_id from acs_objects where object_type=''organization'' loop perform acs_object__delete( object_rec.object_id ); end loop; return 0; end;' language 'plpgsql'; select inline_0(); drop function inline_0(); --drop table drop table organizations; --drop type select acs_object_type__drop_type( 'organization', 't' ); drop table organization_types; drop sequence organization__organization__seq;