Index: openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.6.0b1-5.6.0b2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.6.0b1-5.6.0b2.sql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.6.0b1-5.6.0b2.sql 9 May 2010 11:29:29 -0000 1.1.2.1 +++ openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.6.0b1-5.6.0b2.sql 16 May 2010 00:09:52 -0000 1.1.2.2 @@ -1,2 +1,28 @@ create index acs_objects_package_idx on acs_objects (package_id); -drop index acs_objects_package_object_idx; \ No newline at end of file +drop index acs_objects_package_object_idx; + +-- This is necessary because a previous upgrade script didn't recreate these views. +-- The bio code didn't use these views, but they should be created for future use +-- and consistency. + +drop view acs_users_all; +create view acs_users_all +as +select pa.*, pe.*, u.* +from parties pa, persons pe, users u +where pa.party_id = pe.person_id +and pe.person_id = u.user_id; + +drop view cc_users; +create view cc_users +as +select o.*, pa.*, pe.*, u.*, mr.member_state, mr.rel_id +from acs_objects o, parties pa, persons pe, users u, group_member_map m, membership_rels mr +where o.object_id = pa.party_id + and pa.party_id = pe.person_id + and pe.person_id = u.user_id + and u.user_id = m.member_id + and m.group_id = acs__magic_object_id('registered_users') + and m.rel_id = mr.rel_id + and m.container_id = m.group_id + and m.rel_type = 'membership_rel'; Index: openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.6.0d1-5.6.0d2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.6.0d1-5.6.0d2.sql,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.6.0d1-5.6.0d2.sql 2 Jun 2009 00:40:22 -0000 1.2 +++ openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.6.0d1-5.6.0d2.sql 16 May 2010 00:09:52 -0000 1.2.2.1 @@ -1,4 +1,3 @@ -alter table persons add bio text; create function inline_0 () returns integer as ' @@ -8,6 +7,39 @@ attr_id integer; begin + if exists(select 1 + from acs_attributes + where object_type = ''person'' + and attribute_name = ''bio'' + and storage = ''type_specific'') + then + return 0; + end if; + + alter table persons add bio text; + + drop view acs_users_all; + create view acs_users_all + as + select pa.*, pe.*, u.* + from parties pa, persons pe, users u + where pa.party_id = pe.person_id + and pe.person_id = u.user_id; + + drop view cc_users; + create view cc_users + as + select o.*, pa.*, pe.*, u.*, mr.member_state, mr.rel_id + from acs_objects o, parties pa, persons pe, users u, group_member_map m, membership_rels mr + where o.object_id = pa.party_id + and pa.party_id = pe.person_id + and pe.person_id = u.user_id + and u.user_id = m.member_id + and m.group_id = acs__magic_object_id(''registered_users'') + and m.rel_id = mr.rel_id + and m.container_id = m.group_id + and m.rel_type = ''membership_rel''; + bio_id := attribute_id from acs_attributes where object_type = ''person''