Index: openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.1.4d4-5.1.4d5.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.1.4d4-5.1.4d5.sql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.1.4d4-5.1.4d5.sql	13 Jan 2005 13:55:14 -0000	1.2
+++ openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.1.4d4-5.1.4d5.sql	24 Feb 2005 13:32:58 -0000	1.3
@@ -174,6 +174,7 @@
   return 0; 
 end;' language 'plpgsql';
 
+-- item
 select define_function_args('content_item__del','item_id');
 create or replace function content_item__del (integer)
 returns integer as '
@@ -299,6 +300,7 @@
   return 0; 
 end;' language 'plpgsql';
 
+
 select define_function_args('content_item__delete','item_id');
 create or replace function content_item__delete (integer)
 returns integer as '
@@ -308,3 +310,38 @@
         PERFORM content_item__del (delete__item_id);
   return 0; 
 end;' language 'plpgsql';
+
+
+-- template
+select define_function_args('content_template__del','template_id');
+create or replace function content_template__del (integer)
+returns integer as '
+declare
+  delete__template_id            alias for $1;  
+begin
+
+  delete from cr_type_template_map
+    where template_id = delete__template_id;
+
+  delete from cr_item_template_map
+    where template_id = delete__template_id;
+ 
+  delete from cr_templates
+    where template_id = delete__template_id;
+
+  PERFORM content_item__delete(delete__template_id);
+
+  return 0; 
+end;' language 'plpgsql';
+
+select define_function_args('content_template__delete','template_id');
+
+create or replace function content_template__delete (integer)
+returns integer as '
+declare
+  delete__template_id            alias for $1;  
+begin
+  PERFORM content_template__delete(delete__template_id);
+
+  return 0; 
+end;' language 'plpgsql';
