-- packages/project-manager/sql/project-manager-drop.sql -- drop script -- -- @author jade@bread.com -- @creation-date 2003-05-15 -- @cvs-id $Id: project-manager-drop.sql,v 1.11 2003/12/11 21:39:44 jeffd Exp $ -- -------- -- TASKS -------- -- 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; ------------- -- 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 v_item RECORD; begin for v_item in select item_id from cr_items where content_type = ''pm_task'' LOOP PERFORM pm_task__delete_task_item(v_item.item_id); end loop; return 0; end; ' language 'plpgsql'; 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 ' 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 item_id from cr_items where content_type = ''pm_project'' LOOP 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 ); -- 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; drop table pm_project_category_map; drop sequence pm_project_category_seq; drop table pm_project_category; 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