Index: openacs-4/packages/contacts/sql/postgresql/upgrade/upgrade-1.0d3-1.0d4.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/sql/postgresql/upgrade/upgrade-1.0d3-1.0d4.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/contacts/sql/postgresql/upgrade/upgrade-1.0d3-1.0d4.sql 6 Jul 2005 23:59:26 -0000 1.1 @@ -0,0 +1,45 @@ +-- contacts/sql/postgresql/upgrade/upgrade-1.0d3-1.0d4.sql +-- +-- @author Matthew Geddert openacs@geddert.com +-- @creation-date 2005-07-06 +-- @cvs-id $Id: upgrade-1.0d3-1.0d4.sql,v 1.1 2005/07/06 23:59:26 matthewg Exp $ +-- +-- + + +-- create contact application groups + +create or replace function contacts_upgrade_1d3_to_1d4 () +returns integer as ' +declare + package record; + member record; +begin + + FOR package IN select application_group__new ( + acs_object_id_seq.nextval, + ''application_group'', + now(), + NULL, + NULL, + NULL, + NULL, + ''#contacts.All_Contacts#'', + package_id, + package_id + ) as new_group_id, package_id from apm_packages where package_key = ''contacts'' + LOOP + FOR member IN select distinct member_id from group_member_map where group_id = ''-2'' + LOOP + END LOOP; + + + END LOOP; + + return ''1''; + +end;' language 'plpgsql' stable strict; + +drop function contacts_upgrade_1d3_to_1d4(); + +-- create new relations