X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/9c0d5277adfde9f7daee0b0c83d4e68dd331e905..22dc13d6edb17cbdd4b73aabad340dcc8ef41999:/db/migrate/20120208122334_merge_acl_address_and_mask.rb?ds=sidebyside diff --git a/db/migrate/20120208122334_merge_acl_address_and_mask.rb b/db/migrate/20120208122334_merge_acl_address_and_mask.rb index 791bf659a..09b0ae3b0 100644 --- a/db/migrate/20120208122334_merge_acl_address_and_mask.rb +++ b/db/migrate/20120208122334_merge_acl_address_and_mask.rb @@ -10,7 +10,10 @@ class IPAddr end end -class MergeAclAddressAndMask < ActiveRecord::Migration +class MergeAclAddressAndMask < ActiveRecord::Migration[4.2] + class Acl < ApplicationRecord + end + def up Acl.find_each do |acl| address = IPAddr.new(acl.address) @@ -19,7 +22,7 @@ class MergeAclAddressAndMask < ActiveRecord::Migration while netmask != "0.0.0.0" netmask = netmask << 1 - prefix = prefix + 1 + prefix += 1 end acl.address = "#{address.mask(prefix)}/#{prefix}"