X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/3e99bbf5a9e124a59fc5ae72c863e89af7fa8c46..7ccd11ebf3c8e119a04119a2e89ce6a879560578:/db/migrate/039_add_more_controls_to_gpx_files.rb diff --git a/db/migrate/039_add_more_controls_to_gpx_files.rb b/db/migrate/039_add_more_controls_to_gpx_files.rb index 7cc485e6b..945a7021d 100644 --- a/db/migrate/039_add_more_controls_to_gpx_files.rb +++ b/db/migrate/039_add_more_controls_to_gpx_files.rb @@ -1,10 +1,10 @@ -require 'migrate' +require "migrate" -class AddMoreControlsToGpxFiles < ActiveRecord::Migration +class AddMoreControlsToGpxFiles < ActiveRecord::Migration[5.0] def self.up - create_enumeration :gpx_visibility_enum, ["private", "public", "trackable", "identifiable"] + create_enumeration :gpx_visibility_enum, %w[private public trackable identifiable] add_column :gpx_files, :visibility, :gpx_visibility_enum, :default => "public", :null => false - Trace.update_all("visibility = 'private'", { :public => false }) + Trace.where(:public => false).update_all(:visibility => "private") add_index :gpx_files, [:visible, :visibility], :name => "gpx_files_visible_visibility_idx" remove_index :gpx_files, :name => "gpx_files_visible_public_idx" remove_column :gpx_files, :public @@ -12,7 +12,7 @@ class AddMoreControlsToGpxFiles < ActiveRecord::Migration def self.down add_column :gpx_files, :public, :boolean, :default => true, :null => false - Trace.update_all("public = false", { :visibility => "private" }) + Trace.where(:visibility => "private").update_all(:public => false) add_index :gpx_files, [:visible, :public], :name => "gpx_files_visible_public_idx" remove_index :gpx_files, :name => "gpx_files_visible_visibility_idx" remove_column :gpx_files, :visibility