UPDATE revision.commit
  SET attributes = (attributes - 'primary-objects'::text) 
  WHERE array_length(regexp_split_to_array(attributes->'primary-objects', ','), 1) > 1;
UPDATE revision.commit 
  SET attributes = (attributes || hstore('primary_object', attributes->'primary-objects')) - 'primary-objects'::text
  WHERE attributes?'primary-objects';
