Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-create.sql,v
diff -u -r1.58 -r1.59
--- openacs-4/packages/acs-content-repository/sql/postgresql/content-create.sql	7 Jul 2011 10:46:02 -0000	1.58
+++ openacs-4/packages/acs-content-repository/sql/postgresql/content-create.sql	4 Aug 2011 08:26:20 -0000	1.59
@@ -748,9 +748,12 @@
 --------------------------------------------------------------
 
 create table cr_item_publish_audit (
-  item_id            integer, 
-  old_revision       integer, 
-  new_revision       integer, 
+  item_id            integer 
+                     constraint cr_item_publish_audit_item_fk references cr_items,
+  old_revision       integer
+                     constraint cr_item_publish_audit_orev_fk references cr_revisions (revision_id),
+  new_revision       integer
+                     constraint cr_item_publish_audit_nrev_fk references cr_revisions (revision_id),
   old_status         varchar(40),
   new_status         varchar(40),
   publish_date       timestamptz
@@ -759,6 +762,8 @@
 );
 
 create index cr_item_publish_audit_idx on cr_item_publish_audit(item_id);
+create index cr_item_publish_audit_orev_idx on cr_item_publish_audit(old_revision);
+create index cr_item_publish_audit_nrev_idx on cr_item_publish_audit(new_revision);
 
 comment on table cr_item_publish_audit is '
   An audit table (populated by a trigger on cr_items.live_revision)
