Index: openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.7.0d3-5.7.0d4.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.7.0d3-5.7.0d4.sql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.7.0d3-5.7.0d4.sql	11 Apr 2011 01:08:27 -0000	1.1
+++ openacs-4/packages/acs-content-repository/sql/oracle/upgrade/upgrade-5.7.0d3-5.7.0d4.sql	24 Apr 2011 21:41:28 -0000	1.2
@@ -1,23 +1,38 @@
 declare
  attr_id	acs_attributes.attribute_id%TYPE;
+ exists_p integer;
 begin
 
- attr_id := content_type.create_attribute (
-   content_type   => 'content_revision',
-   attribute_name => 'item_id',
-   datatype => 'integer',
-   pretty_name => 'Item id',
-   pretty_plural => 'Item ids'
- );
+  select count(*) into exists_p
+  from acs_attributes
+  where object_type = 'content_revision'
+    and attribute_name = 'item_id';
 
- attr_id := content_type.create_attribute (
-   content_type   => 'content_revision',
-   attribute_name => 'content',
-   datatype => 'text',
-   pretty_name => 'content',
-   pretty_plural => 'content'
- );
+  if exists_p = 0 then
+    attr_id := content_type.create_attribute (
+      content_type   => 'content_revision',
+      attribute_name => 'item_id',
+      datatype => 'integer',
+      pretty_name => 'Item id',
+      pretty_plural => 'Item ids'
+    );
+  end if;
 
+  select count(*) into exists_p
+  from acs_attributes
+  where object_type = 'content_revision'
+    and attribute_name = 'content';
+
+  if exists_p = 0 then
+    attr_id := content_type.create_attribute (
+      content_type   => 'content_revision',
+      attribute_name => 'content',
+      datatype => 'text',
+      pretty_name => 'content',
+      pretty_plural => 'content'
+    );
+  end if;
+
 end;
 /
 show errors
