The Toolkit for Online Communities
18163 Community Members, 0 members online, 1821 visitors today
Log In Register
OpenACS Home : Forums : OpenACS Development : Drop script for organizations : One Message

Forum OpenACS Development: Re: Drop script for organizations

Posted by Tilmann Singer on
Jade, you don't need to drop permissions explicitely. A farely recent openacs version should do that automatically.

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?

Posted by Jade Rubick on
Tilmann: thanks for your help. If permissions don't need to explicitly dropped, then we need to reflect this in the installation documents (http://openacs.org/doc/openacs-4-6-3/tutorial-database.html says to put it in there). I'll post a bug on the bug-tracker about this (at http://openacs.org/bugtracker/openacs/com/acs-core-docs/bug?bug%5fnumber=556)

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 '
        object_rec              record;
        for object_rec in select object_id from acs_objects where object_type=''organization''
                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(

drop table organization_types; 
drop sequence organization__organization__seq;