Index: openacs-4/packages/project-manager/sql/oracle/project-manager-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/project-manager/sql/oracle/project-manager-drop.sql,v
diff -u -r1.2 -r1.2.2.1
--- openacs-4/packages/project-manager/sql/oracle/project-manager-drop.sql	30 Apr 2005 06:59:33 -0000	1.2
+++ openacs-4/packages/project-manager/sql/oracle/project-manager-drop.sql	30 Nov 2005 06:47:36 -0000	1.2.2.1
@@ -10,140 +10,114 @@
 -- TASKS
 --------
 
-\i project-manager-custom-drop.sql
-\i project-manager-notifications-drop.sql
+@project-manager-custom-drop.sql
+@project-manager-notifications-drop.sql
 
 drop table pm_task_logger_proj_map;
 
-create function inline_0 ()
-returns integer as '
 declare
-    v_item RECORD;
-        
 begin
-        for v_item in select 
+        for row in (select 
                 item_id
                 from 
                 cr_items
                 where 
-                content_type = ''pm_task''
+                content_type = 'pm_task')
         LOOP
-                PERFORM pm_task__delete_task_item(v_item.item_id);
+                pm_task.delete_task_item(row.item_id);
         end loop;
-
-    return 0;
 end;
-' language 'plpgsql';
+/
+show errors
 
-select inline_0();
-drop function inline_0();
-
 -- 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 all contents of projects folder
-    FOR v_item_cursor IN
-        select
+    FOR row IN
+        (select
         item_id
         from
         cr_items
         where
-        content_type = ''pm_task''
+        content_type = 'pm_task')
     LOOP
-        PERFORM pm_project__delete_task_item(v_item_cursor.item_id);
+        pm_task.delete_task_item(row.item_id);
     END LOOP;
 
-    -- this table must not hold reference to ''pm_tasks'' type
-    delete from cr_folder_type_map where content_type = ''pm_tasks'';
-
-    return 0;
+    -- this table must not hold reference to 'pm_tasks' type
+    delete from cr_folder_type_map where content_type = 'pm_tasks';
 end;
-' language 'plpgsql';
+/
+show errors
 
-select inline_0();
-drop function inline_0();
 
 -- 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 all contents of projects folder
-    FOR v_item_cursor IN
-        select
+    FOR row IN
+        (select
         item_id
         from
         cr_items
         where
-        content_type = ''pm_project''
+        content_type = 'pm_project')
     LOOP
-        PERFORM pm_project__delete_project_item(v_item_cursor.item_id);
+        pm_project.delete_project_item(row.item_id);
     END LOOP;
-
-    return 0;
 end;
-' language 'plpgsql';
+/
+show errors
 
-select inline_0();
-drop function inline_0();
 
 -- 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
-
-    FOR v_item_cursor IN 
-        select folder_id from cr_folders where description=''Project Repository'' 
+    FOR row 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
+    content_folder.unregister_content_type (
+        row.folder_id,   -- folder_id
+        'pm_project',         -- content_type
+        't'                   -- include_subtypes
     );
-    PERFORM content_folder__delete(v_item_cursor.folder_id);
+    content_folder.del(row.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;
+    -- this table must not hold reference to 'pm_project' type
+    delete from cr_folder_type_map where content_type = 'pm_project';
 end;
-' language 'plpgsql';
+/
+show errors
 
-select inline_0();
-drop function inline_0();
 
-
 -- task dependency types
-drop table pm_task_dependency_types cascade;
-drop table pm_task_dependency cascade;
+drop table pm_task_dependency_types cascade constraints;
+drop table pm_task_dependency cascade constraints;
 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');
+begin
+content_type.drop_attribute ('pm_task', 'end_date', 't');
+content_type.drop_attribute ('pm_task', 'percent_complete', 't');
+content_type.drop_attribute ('pm_task', 'estimated_hours_work', 't');
+content_type.drop_attribute ('pm_task', 'estimated_hours_work_min', 't');
+content_type.drop_attribute ('pm_task', 'estimated_hours_work_max', 't');
+content_type.drop_attribute ('pm_task', 'actual_hours_worked', 't');
+content_type.drop_attribute ('pm_task', 'earliest_start', 't');
+content_type.drop_attribute ('pm_task', 'earliest_finish', 't');
+content_type.drop_attribute ('pm_task', 'latest_start', 't');
+content_type.drop_attribute ('pm_task', 'latest_finish', 't');
+end;
+/
+show errors
 
 -------------
 -- WORKGROUPS
@@ -161,22 +135,22 @@
 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;
+drop table pm_process_task_assignment cascade constraints;
+drop table pm_process_task_dependency cascade constraints;
+drop table pm_process_task cascade constraints;
+drop table pm_process cascade constraints;
 
 ---------
 -- OTHERS
 ---------
-drop table pm_default_roles;
-drop table pm_project_assignment;
-drop table pm_task_assignment;
-drop table pm_roles;
+drop table pm_default_roles cascade constraints;
+drop table pm_project_assignment cascade constraints;
+drop table pm_task_assignment cascade constraints;
+drop table pm_roles cascade constraints;
 drop sequence pm_role_seq;
 
 
-select drop_package('pm_task');
+drop package pm_task;
 
 
 -----------
@@ -188,25 +162,32 @@
 
 
 -- drop package, which drops all functions created with define_function_args
-select drop_package('pm_project');
+drop package pm_project;
 
 --drop table
-drop table pm_projects cascade;
+drop table pm_projects cascade constraints;
 
 drop sequence pm_project_status_seq;
-drop table pm_project_status cascade;
+drop table pm_project_status cascade constraints;
 
 
 
 drop sequence pm_task_status_seq;
-drop table pm_task_status cascade;
+drop table pm_task_status cascade constraints;
 
-drop table pm_tasks cascade;
-drop table pm_tasks_revisions cascade;
+drop table pm_tasks cascade constraints;
+drop table pm_tasks_revisions cascade constraints;
 
-select content_type__drop_type('pm_task', 't', 'f');
+begin
+content_type.drop_type('pm_task', 't', 'f');
+content_type.drop_type('pm_project', 't', 'f');
+end;
+/
+show errors
 
-select content_type__drop_type('pm_project', 't', 'f');
-
+drop table pm_task_xref cascade constraints; 
+drop table pm_users_viewed cascade constraints;
+drop sequence pm_process_instance_seq;
+drop table pm_process_instance cascade constraints;
 -- note that the Project Repository folder is not deleted
 
