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.6 -r1.10.2.7
--- openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-drop.sql	5 Feb 2004 23:57:49 -0000	1.10.2.6
+++ openacs-4/contrib/packages/project-manager/sql/postgresql/project-manager-drop.sql	27 Feb 2004 22:46:12 -0000	1.10.2.7
@@ -13,54 +13,6 @@
 \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
--------------
-
-drop sequence pm_workgroup_seq;
-drop table pm_workgroup_parties;
-drop table pm_workgroup;
-
-------------
--- PROCESSES
-------------
-
-drop sequence pm_process_seq;
-drop sequence pm_process_task_seq;
-drop sequence pm_process_task_dependency_seq;
-
-drop table pm_process_task_assignment;
-drop table pm_process_task_dependency;
-drop table pm_process_task;
-drop table pm_process;
-
----------
--- OTHERS
----------
-drop table pm_default_roles;
-drop table pm_project_assignment;
-drop table pm_task_assignment;
-drop table pm_roles;
-drop sequence pm_role_seq;
-
-
 create function inline_0 ()
 returns integer as '
 declare
@@ -84,16 +36,6 @@
 select inline_0();
 drop function inline_0();
 
-select drop_package('pm_task');
-
-
------------
--- PROJECTS
------------
-
---drop permissions
-delete from acs_permissions where object_id in (select project_id from pm_projects);
-
 -- unregister content_types from folder
 create function inline_0 ()
 returns integer as '
@@ -110,53 +52,21 @@
         from
         cr_items
         where
-        content_type = ''pm_project''
+        content_type = ''pm_task''
     LOOP
-        PERFORM pm_project__delete_project_item(v_item_cursor.item_id);
+        PERFORM pm_project__delete_task_item(v_item_cursor.item_id);
     END LOOP;
 
-    select content_item__get_id(''projects'', null, ''f'') into v_folder_id from dual;
+    -- this table must not hold reference to ''pm_tasks'' type
+    delete from cr_folder_type_map where content_type = ''pm_tasks'';
 
-    -- unregister_content_types
-    PERFORM content_folder__unregister_content_type (
-        v_folder_id,            -- folder_id
-        ''pm_project'',         -- 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_project'';
-
-    -- delete projects folder
-    PERFORM content_folder__delete(v_folder_id);
-
-    -- delete the content folders
-    FOR v_item_cursor IN
-        select f.folder_id 
-        from   cr_folders f, 
-               cr_items   i
-        where  f.folder_id = i.item_id and 
-               description = ''Project Repository''
-    LOOP
-        PERFORM content_item__delete(v_item_cursor.folder_id);
-    END LOOP;
-
     return 0;
 end;
 ' language 'plpgsql';
 
 select inline_0();
 drop function inline_0();
 
--- drop package, which drops all functions created with define_function_args
-select drop_package('pm_project');
-
---drop table
-drop table pm_projects cascade;
-
-drop sequence pm_project_status_seq;
-drop table pm_project_status;
-
 -- unregister content_types from folder
 create function inline_0 ()
 returns integer as '
@@ -173,26 +83,41 @@
         from
         cr_items
         where
-        content_type = ''pm_task''
+        content_type = ''pm_project''
     LOOP
-        PERFORM pm_project__delete_task_item(v_item_cursor.item_id);
+        PERFORM pm_project__delete_project_item(v_item_cursor.item_id);
     END LOOP;
 
-    --select content_item__get_id(''tasks'', null, ''f'') into v_folder_id from dual;
+    return 0;
+end;
+' language 'plpgsql';
 
-    -- unregister_content_types
-    --PERFORM content_folder__unregister_content_type (
-    --    v_folder_id,            -- folder_id
-    --    ''pm_tasks'',           -- content_type
-    --    ''t''                   -- include_subtypes
-    --);
+select inline_0();
+drop function inline_0();
 
-    -- this table must not hold reference to ''pm_project'' type
-    delete from cr_folder_type_map where content_type = ''pm_tasks'';
+-- 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
 
-    -- delete projects folder
-    --PERFORM content_folder__delete(v_folder_id);
+    FOR v_item_cursor IN 
+        select folder_id from cr_folders where description=''Project Repository'' 
+    LOOP
+    PERFORM content_folder__unregister_content_type (
+        v_item_cursor.folder_id,   -- folder_id
+        ''pm_project'',         -- content_type
+        ''t''                   -- include_subtypes
+    );
+    PERFORM content_folder__delete(v_item_cursor.folder_id);
+    END LOOP;
 
+    -- this table must not hold reference to ''pm_project'' type
+    delete from cr_folder_type_map where content_type = ''pm_project'';
+
     return 0;
 end;
 ' language 'plpgsql';
@@ -201,8 +126,78 @@
 drop function inline_0();
 
 
+-- 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
+-------------
+
+drop sequence pm_workgroup_seq;
+drop table pm_workgroup_parties;
+drop table pm_workgroup;
+
+------------
+-- PROCESSES
+------------
+
+drop sequence pm_process_seq;
+drop sequence pm_process_task_seq;
+drop sequence pm_process_task_dependency_seq;
+
+drop table pm_process_task_assignment;
+drop table pm_process_task_dependency;
+drop table pm_process_task;
+drop table pm_process;
+
+---------
+-- OTHERS
+---------
+drop table pm_default_roles;
+drop table pm_project_assignment;
+drop table pm_task_assignment;
+drop table pm_roles;
+drop sequence pm_role_seq;
+
+
+select drop_package('pm_task');
+
+
+-----------
+-- PROJECTS
+-----------
+
+--drop permissions
+delete from acs_permissions where object_id in (select project_id from pm_projects);
+
+
+-- drop package, which drops all functions created with define_function_args
+select drop_package('pm_project');
+
+--drop table
+drop table pm_projects cascade;
+
+drop sequence pm_project_status_seq;
+drop table pm_project_status cascade;
+
+
+
 drop sequence pm_task_status_seq;
-drop table pm_task_status;
+drop table pm_task_status cascade;
 
 drop table pm_tasks cascade;
 drop table pm_tasks_revisions cascade;
