3 class AddMoreControlsToGpxFiles < ActiveRecord::Migration[4.2]
4 class Trace < ApplicationRecord
5 self.table_name = "gpx_files"
9 create_enumeration :gpx_visibility_enum, %w[private public trackable identifiable]
10 add_column :gpx_files, :visibility, :gpx_visibility_enum, :default => "public", :null => false
11 Trace.where(:public => false).update_all(:visibility => "private")
12 add_index :gpx_files, [:visible, :visibility], :name => "gpx_files_visible_visibility_idx"
13 remove_index :gpx_files, :name => "gpx_files_visible_public_idx"
14 remove_column :gpx_files, :public
18 add_column :gpx_files, :public, :boolean, :default => true, :null => false
19 Trace.where(:visibility => "private").update_all(:public => false)
20 add_index :gpx_files, [:visible, :public], :name => "gpx_files_visible_public_idx"
21 remove_index :gpx_files, :name => "gpx_files_visible_visibility_idx"
22 remove_column :gpx_files, :visibility
23 drop_enumeration :gpx_visibility_enum