X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/565171486f6d90321e0291d5ccc3cf6a1c12e730..a69c016b40d3232379e69bad91e76ce5e9ccfb98:/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..c1e20ffd7 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 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