X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/565171486f6d90321e0291d5ccc3cf6a1c12e730..f86bb781c9e2f93f7f3a5b638bfc9c3d32160129:/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 133838ac2..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 'lib/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