Index: openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/sql/postgresql/Attic/project-manager-drop.sql,v
diff -u -r1.10.2.4 -r1.10.2.5
--- openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-drop.sql	10 Jan 2004 01:04:02 -0000	1.10.2.4
+++ openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-drop.sql	4 Feb 2004 20:17:19 -0000	1.10.2.5
@@ -10,6 +10,9 @@
 -- TASKS
 --------
 
+\i project-manager-custom-drop.sql
+\i project-manager-notifications-drop.sql
+
 -- task dependency types
 drop table pm_task_dependency_types cascade;
 drop table pm_task_dependency cascade;
@@ -84,7 +87,7 @@
 create function inline_0 ()
 returns integer as '
 declare
-    v_folder_id	  cr_folders.folder_id%TYPE;
+    v_folder_id   cr_folders.folder_id%TYPE;
     v_item_id     cr_items.item_id%TYPE;
     v_item_cursor RECORD;
 begin
@@ -98,16 +101,16 @@
         where
         content_type = ''pm_project''
     LOOP
-       	PERFORM pm_project__delete_project_item(v_item_cursor.item_id);
+        PERFORM pm_project__delete_project_item(v_item_cursor.item_id);
     END LOOP;
 
     select content_item__get_id(''projects'', null, ''f'') into v_folder_id from dual;
 
     -- unregister_content_types
     PERFORM content_folder__unregister_content_type (
-        v_folder_id,		-- folder_id
-        ''pm_project'',		-- content_type
-        ''t''			-- include_subtypes
+        v_folder_id,            -- folder_id
+        ''pm_project'',         -- content_type
+        ''t''                   -- include_subtypes
     );
 
     -- this table must not hold reference to ''pm_project'' type
@@ -124,7 +127,7 @@
         where  f.folder_id = i.item_id and 
                description = ''Project Repository''
     LOOP
-       	PERFORM content_item__delete(v_item_cursor.folder_id);
+        PERFORM content_item__delete(v_item_cursor.folder_id);
     END LOOP;
 
     return 0;
@@ -143,16 +146,56 @@
 drop sequence pm_project_status_seq;
 drop table pm_project_status;
 
-drop table pm_project_category_map;
+-- unregister content_types from folder
+create function inline_0 ()
+returns integer as '
+declare
+    v_folder_id   cr_folders.folder_id%TYPE;
+    v_item_id     cr_items.item_id%TYPE;
+    v_item_cursor RECORD;
+begin
 
-drop sequence pm_project_category_seq;
-drop table pm_project_category;
+    -- delete all contents of projects folder
+    FOR v_item_cursor IN
+        select
+        item_id
+        from
+        cr_items
+        where
+        content_type = ''pm_task''
+    LOOP
+        PERFORM pm_project__delete_task_item(v_item_cursor.item_id);
+    END LOOP;
 
+    --select content_item__get_id(''tasks'', null, ''f'') into v_folder_id from dual;
+
+    -- unregister_content_types
+    --PERFORM content_folder__unregister_content_type (
+    --    v_folder_id,            -- folder_id
+    --    ''pm_tasks'',           -- content_type
+    --    ''t''                   -- include_subtypes
+    --);
+
+    -- this table must not hold reference to ''pm_project'' type
+    delete from cr_folder_type_map where content_type = ''pm_tasks'';
+
+    -- delete projects folder
+    --PERFORM content_folder__delete(v_folder_id);
+
+    return 0;
+end;
+' language 'plpgsql';
+
+select inline_0();
+drop function inline_0();
+
+
 select content_type__drop_type('pm_task', 't', 'f');
 
 drop table pm_tasks cascade;
 drop table pm_tasks_revisions cascade;
 
+
 select content_type__drop_type('pm_project', 't', 'f');
 
 -- note that the Project Repository folder is not deleted
