-- -- Drop the data model and the PL/SQL packages. -- -- Views -- drop view download_repository_obj; drop view download_archives_obj; drop view download_arch_revisions_obj; drop view download_downloads_repository; -- Sequences -- drop sequence download_archive_type_seq; drop view download_archive_type_sequence; drop sequence download_reasons_seq; drop view download_reasons_sequence; drop sequence download_md_choice_id_seq; drop view download_md_choice_id_sequence; drop sequence download_downloads_seq; drop view download_downloads_sequence; -- Functions -- drop function download_rep__new (integer,varchar,varchar,varchar,timestamp,integer,integer,integer,varchar); drop function download_rep__edit (integer,varchar,varchar,varchar,timestamp,integer,varchar); drop function download_rep__delete (integer); -- Tables -- drop table download_downloads; drop table download_revision_data; drop table download_archive_revisions; --drop table download_archives; drop table download_metadata_choices; drop table download_archive_metadata; drop table download_reasons; drop table download_archive_types; --drop table download_repository; --drop table download_archive_descs; /* Drop all content items */ create function inline_0 () returns integer as ' declare archive_rec cr_items%ROWTYPE; archive_child_rec acs_object_context_index%ROWTYPE; begin for archive_rec in select * from cr_items where content_type in ( ''cr_download_archive'', ''cr_download_archive_desc'', ''cr_download_rep'' ) loop -- for archive_child_rec in select * from acs_object_context_index where ancestor_id = archive_rec.item_id loop -- PERFORM content_item__delete( archive_child_rec.object_id ); -- end loop; update cr_items set live_revision=null, latest_revision=null where item_id=archive_rec.item_id; PERFORM content_item__delete( archive_rec.item_id ); end loop; return 0; end;' language 'plpgsql'; select inline_0 (); drop function inline_0 (); --begin -- for archive_rec in (select item_id from cr_items where content_type = 'cr_download_archive_desc') -- loop -- content_item.delete(archive_rec.item_id); -- end loop; --end; --/ -- --begin -- for archive_rec in (select item_id from cr_items where content_type = 'cr_download_archive') -- loop -- content_item.delete(archive_rec.item_id); -- end loop; --end; --/ -- --begin -- for archive_rec in (select item_id from cr_items where content_type = 'cr_download_rep') -- loop -- content_item.delete(archive_rec.item_id); -- end loop; --end; --/ /* acs_object_type */ create function inline_1 () returns integer as ' begin PERFORM content_type__unregister_child_type ( ''cr_download_rep'', ''cr_download_archive'', ''generic'' ); PERFORM content_type__unregister_child_type ( ''cr_download_rep'', ''cr_download_archive_desc'', ''generic'' ); PERFORM content_type__drop_type ( ''cr_download_archive_desc'', ''t'', ''t'' ); PERFORM content_type__drop_type ( ''cr_download_archive'', ''t'', ''t'' ); PERFORM content_type__drop_type ( ''cr_download_rep'', ''t'', ''t'' ); return 0; end;' language 'plpgsql'; select inline_1 (); drop function inline_1 (); --begin -- content_type.unregister_child_type( -- parent_type => 'cr_download_rep', -- child_type => 'cr_download_archive', -- relation_tag => 'generic' -- ); -- -- content_type.unregister_child_type( -- parent_type => 'cr_download_rep', -- child_type => 'cr_download_archive_desc', -- relation_tag => 'generic' -- ); --end; --/ -- --begin -- acs_object_type.drop_type( -- object_type => 'cr_download_archive_desc', -- cascade_p => 't' -- ); --end; --/ --show errors -- --begin -- acs_object_type.drop_type( -- object_type => 'cr_download_rep', -- cascade_p => 't' -- ); --end; --/ --show errors -- --begin -- acs_object_type.drop_type( -- object_type => 'cr_download_archive', -- cascade_p => 't' -- ); -- --end; --/ --show errors -- --drop package download_rep;