require "migrate"
-class AddMoreControlsToGpxFiles < ActiveRecord::Migration
+class AddMoreControlsToGpxFiles < ActiveRecord::Migration[4.2]
+ class Trace < ActiveRecord::Base
+ self.table_name = "gpx_files"
+ end
+
def self.up
- create_enumeration :gpx_visibility_enum, %w(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.where(:public => false).update_all(:visibility => "private")
add_index :gpx_files, [:visible, :visibility], :name => "gpx_files_visible_visibility_idx"