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.62 -r1.63
--- openacs-4/packages/acs-content-repository/sql/postgresql/content-create.sql	2 May 2015 17:23:21 -0000	1.62
+++ openacs-4/packages/acs-content-repository/sql/postgresql/content-create.sql	3 May 2015 12:32:28 -0000	1.63
@@ -400,8 +400,9 @@
 
 create index cr_child_rels_by_parent on cr_child_rels(parent_id);
 create unique index cr_child_rels_unq_id on cr_child_rels(parent_id, child_id);
-CREATE UNIQUE INDEX CR_CHILD_RELS_kids_IDx ON CR_CHILD_RELS(CHILD_ID);
+create unique index cr_child_rels_child_id_idx on cr_child_rels(child_id);
 
+
 comment on table cr_child_rels is '
   Provides for richer parent-child relationships than the simple
   link encapsulated in the primary table.  May be subclassed to provide
@@ -507,10 +508,10 @@
 ';
 
 alter table cr_items add constraint cr_items_live_fk 
-      foreign key (live_revision) references cr_revisions(revision_id);
+      foreign key (live_revision) references cr_revisions(revision_id) on delete set null;
 
 alter table cr_items add constraint cr_items_latest_fk 
-     foreign key (latest_revision) references cr_revisions(revision_id);
+     foreign key (latest_revision) references cr_revisions(revision_id) on delete set null;
 
 
 
@@ -740,11 +741,11 @@
 
 create table cr_item_publish_audit (
   item_id            integer 
-                     constraint cr_item_publish_audit_item_fk references cr_items,
+                     constraint cr_item_publish_audit_item_fk references cr_items (item_id) on delete cascade,
   old_revision       integer
-                     constraint cr_item_publish_audit_orev_fk references cr_revisions (revision_id),
+                     constraint cr_item_publish_audit_orev_fk references cr_revisions (revision_id) on delete cascade,
   new_revision       integer
-                     constraint cr_item_publish_audit_nrev_fk references cr_revisions (revision_id),
+                     constraint cr_item_publish_audit_nrev_fk references cr_revisions (revision_id) on delete cascade,
   old_status         varchar(40),
   new_status         varchar(40),
   publish_date       timestamptz
@@ -764,7 +765,7 @@
 create table cr_release_periods (
   item_id          integer
                    constraint cr_release_periods_item_id_fk
-		   references cr_items
+		   references cr_items on delete cascade
                    constraint cr_release_periods_item_id_pk
 		   primary key,
   start_when	   timestamptz default current_timestamp,
@@ -913,7 +914,7 @@
 create table cr_item_template_map (
   item_id          integer
                    constraint cr_item_template_map_item_fk
-                   references cr_items
+                   references cr_items (item_id) on delete cascade
                    constraint cr_item_template_map_item_nn
                    not null,
   template_id      integer
@@ -1151,7 +1152,7 @@
 create table cr_item_keyword_map (
   item_id          integer
                    constraint cr_item_keyword_map_item_id_fk
-                   references cr_items
+                   references cr_items (item_id) on delete cascade
                    constraint cr_item_keyword_map_item_id_nn
                    not null,
   keyword_id       integer
