Forum OpenACS Development: Re: Drop script for organizations

Collapse
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 (https://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 https://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 https://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;