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.3
--- 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	17 Oct 2010 21:06:08 -0000	1.3
@@ -1,13 +1,37 @@
-alter table persons add bio text;
 
 create function inline_0 ()
 returns integer as '
 declare
   one_user_id integer;
   bio_id integer;
+  bio_mime_type_id integer;
   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;
+
+  bio_mime_type_id := attribute_id
+                      from acs_attributes
+                      where object_type = ''person''
+                      and attribute_name = ''bio_mime_type'';
+
   bio_id := attribute_id
             from acs_attributes
             where object_type = ''person''
@@ -30,6 +54,9 @@
   delete from acs_attribute_values
   where attribute_id = bio_id;
 
+  delete from acs_attribute_values
+  where attribute_id = bio_mime_type_id;
+
   perform acs_attribute__drop_attribute (''person'',''bio'');
   perform acs_attribute__drop_attribute (''person'',''bio_mime_type'');
 
