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