Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leftclickben/7e2a3a86d5bc91b43734 to your computer and use it in GitHub Desktop.
Save leftclickben/7e2a3a86d5bc91b43734 to your computer and use it in GitHub Desktop.
cleanup-providence-database-after-relationship-generator-integration-test.sql
-- Cleans up any data that might be remnant after a run of the RelationshipGeneratorPluginIntegrationTest,
-- particularly if the run fails for some reason, it might not execute its tearDown() and can leave remnant
-- data in the database.
-- NOTE YOU WILL NEED TO MODIFY SOME OF THE HARDCODED VALUES IN HERE TO SUIT YOUR CURRENT DATABASE
-- Alternatively this could probably be improved to use more of the "code like '%...%'" and less of the "id > X" style
delete from ca.ca_attribute_values where value_id > 14;
delete from ca.ca_attributes where table_num = 57 and element_id = 70 and row_id > 46;
delete from ca.ca_attributes where table_num = 13 and element_id in (22,40) and row_id > 236;
delete from ca.ca_metadata_type_restrictions where table_num = 57 and element_id = 70 and type_id > 1421;
delete from ca.ca_objects_x_collections where object_id >= 34;
delete from ca.ca_object_labels where object_id >= 34;
delete from ca.ca_objects where object_id >= 34;
delete from ca.ca_collection_labels where collection_id > 2;
delete from ca.ca_collections where collection_id > 2;
delete from ca.ca_list_item_labels where name_singular like 'test_%';
delete from ca.ca_list_items where list_id in ( 6, 27 ) and idno like '%_test_%';
delete from ca.ca_relationship_type_labels where type_id in ( select type_id from ca.ca_relationship_types where type_code like '%_test' );
delete from ca.ca_relationship_types where type_code like '%_test';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment