X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f4ca9ad94a6bb006d1f3c7ba207837f1736d1247..dcdf385b2852acf95f41e2340d07cd68cb34e371:/services/api/db/migrate/20130118002239_rename_metadata_attributes.rb diff --git a/services/api/db/migrate/20130118002239_rename_metadata_attributes.rb b/services/api/db/migrate/20130118002239_rename_metadata_attributes.rb index deaa35c256..2c1b406000 100644 --- a/services/api/db/migrate/20130118002239_rename_metadata_attributes.rb +++ b/services/api/db/migrate/20130118002239_rename_metadata_attributes.rb @@ -1,4 +1,8 @@ -class RenameMetadataAttributes < ActiveRecord::Migration +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + +class RenameMetadataAttributes < ActiveRecord::Migration[4.2] def up rename_column :metadata, :target_kind, :tail_kind rename_column :metadata, :target_uuid, :tail @@ -13,7 +17,7 @@ class RenameMetadataAttributes < ActiveRecord::Migration Metadatum.where('head like ?', 'orvos#%').each do |m| kind_uuid = m.head.match /^(orvos\#.*)\#([-0-9a-z]+)$/ if kind_uuid - m.update_attributes(head_kind: kind_uuid[1], + m.update(head_kind: kind_uuid[1], head: kind_uuid[2]) end end @@ -24,7 +28,7 @@ class RenameMetadataAttributes < ActiveRecord::Migration def down begin Metadatum.where('head_kind is not null and head_kind <> ? and head is not null', '').each do |m| - m.update_attributes(head: m.head_kind + '#' + m.head) + m.update(head: m.head_kind + '#' + m.head) end rescue end