Index: openacs-4/packages/acs-mail/sql/postgresql/acs-mail-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-mail/sql/postgresql/acs-mail-drop.sql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/acs-mail/sql/postgresql/acs-mail-drop.sql	8 Jul 2001 18:41:34 -0000	1.1
+++ openacs-4/packages/acs-mail/sql/postgresql/acs-mail-drop.sql	13 Aug 2001 17:29:54 -0000	1.2
@@ -8,13 +8,15 @@
 
 -- FIXME: This script has NOT been tested! - vinodk
 
+\i acs-mail-nt-drop.sql
+
 drop function acs_mail_queue_message__new (integer,integer,
 	 integer,timestamp,integer,varchar,varchar);
 drop function acs_mail_queue_message__delete (integer);
 
-drop table acs_mail_queue_messages;
 drop table acs_mail_queue_incoming;
 drop table acs_mail_queue_outgoing;
+drop table acs_mail_queue_messages;
 
 select acs_object_type__drop_type (
 	'acs_mail_queue_message',
@@ -45,23 +47,42 @@
 
 drop index acs_mail_body_hdrs_body_id_idx;
 
-drop table acs_mail_gc_objects;
-drop table acs_mail_bodies;
+create function inline_0 ()
+returns integer as '
+declare
+	v_rec		acs_objects%ROWTYPE;
+begin
+	for v_rec in select object_id from acs_objects where object_type in (''acs_mail_multipart'',''acs_mail_link'',''acs_mail_body'',''acs_mail_gc_object'') order by object_id desc
+	loop
+		perform acs_object__delete( v_rec.object_id );
+	end loop;
+
+	return 0;
+end;' language 'plpgsql';
+
+select inline_0 ();
+
+drop function inline_0 ();
+
+
 drop table acs_mail_body_headers;
-drop table acs_mail_multiparts;
 drop table acs_mail_multipart_parts;
+drop table acs_mail_multiparts;
 drop table acs_mail_links;
+drop table acs_mail_bodies;
+drop table acs_mail_gc_objects;
 
 select acs_object_type__drop_type (
-	'acs_mail_link',
+	'acs_mail_multipart',
 	't'
 );
 
 select acs_object_type__drop_type (
-	'acs_mail_multipart',
+	'acs_mail_link',
 	't'
 );
 
+
 select acs_object_type__drop_type (
 	'acs_mail_body',
 	't'
@@ -71,3 +92,4 @@
 	'acs_mail_gc_object',
 	't'
 );
+
