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.12 -r1.13
--- openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-drop.sql	26 Jan 2004 15:39:40 -0000	1.12
+++ openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-drop.sql	26 Feb 2004 15:15:40 -0000	1.13
@@ -10,12 +10,26 @@
 -- 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;
 drop sequence pm_task_dependency_seq;
 drop sequence pm_tasks_number_seq;
 
+select content_type__drop_attribute ('pm_task', 'end_date', 't');
+select content_type__drop_attribute ('pm_task', 'percent_complete', 't');
+select content_type__drop_attribute ('pm_task', 'estimated_hours_work', 't');
+select content_type__drop_attribute ('pm_task', 'estimated_hours_work_min', 't');
+select content_type__drop_attribute ('pm_task', 'estimated_hours_work_max', 't');
+select content_type__drop_attribute ('pm_task', 'actual_hours_worked', 't');
+select content_type__drop_attribute ('pm_task', 'earliest_start', 't');
+select content_type__drop_attribute ('pm_task', 'earliest_finish', 't');
+select content_type__drop_attribute ('pm_task', 'latest_start', 't');
+select content_type__drop_attribute ('pm_task', 'latest_finish', 't');
+
 -------------
 -- WORKGROUPS
 -------------
@@ -84,7 +98,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 +112,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 +138,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 +157,58 @@
 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_type__drop_type('pm_task', 't', 'f');
+    --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();
+
+
+drop sequence pm_task_status_seq;
+drop table pm_task_status;
+
 drop table pm_tasks cascade;
 drop table pm_tasks_revisions cascade;
 
+select content_type__drop_type('pm_task', 't', 'f');
+
 select content_type__drop_type('pm_project', 't', 'f');
 
 -- note that the Project Repository folder is not deleted
