Skip to content

Instantly share code, notes, and snippets.

@kehh
Last active August 29, 2015 14:08
Show Gist options
  • Save kehh/5cba7d60d57e408bcc50 to your computer and use it in GitHub Desktop.
Save kehh/5cba7d60d57e408bcc50 to your computer and use it in GitHub Desktop.
Clean Storage Locations
-- ssh wamadm@wamcmis
-- sudo su cmis
-- mysql cmis
begin;
create table sl_deletes as select location_id from ca_storage_location_labels where name = 'Kew Street' and location_id != 3;
alter table sl_deletes add primary key (location_id);
update ca_objects_x_storage_locations set location_id = 3 where location_id in (select location_id from sl_deletes);
set innodb_lock_wait_timeout=360;
delete from ca_storage_location_labels where location_id in (select location_id from sl_deletes);
delete from ca_storage_locations where location_id in (select location_id from sl_deletes);
drop table sl_deletes;
commit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment