require "migrate"
class TileTracepoints < ActiveRecord::Migration[4.2]
+ class Tracepoint < ActiveRecord::Base
+ self.table_name = "gps_points"
+ end
+
def self.up
add_column "gps_points", "tile", :bigint
add_index "gps_points", ["tile"], :name => "points_tile_idx"
require "migrate"
class TileNodes < ActiveRecord::Migration[4.2]
+ class Node < ActiveRecord::Base
+ self.table_name = "current_nodes"
+ end
+
+ class OldNode < ActiveRecord::Base
+ self.table_name = "nodes"
+ end
+
def self.upgrade_table(from_table, to_table, model)
if ENV["USE_DB_FUNCTIONS"]
execute <<-SQL
class AddEmailValid < ActiveRecord::Migration[4.2]
+ class User < ActiveRecord::Base
+ end
+
def self.up
add_column "users", "email_valid", :boolean, :default => false, :null => false
User.update_all("email_valid = (active != 0)") # email_valid is :boolean, but active is :integer. "email_valid = active" (see r11802 or earlier) will fail for stricter dbs than mysql
require "migrate"
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]
add_column :gpx_files, :visibility, :gpx_visibility_enum, :default => "public", :null => false
require "migrate"
class AlterUserRolesAndBlocks < ActiveRecord::Migration[4.2]
+ class UserRole < ActiveRecord::Base
+ end
+
def self.up
# the initial granter IDs can be "self" - there are none of these
# in the current live DB, but there may be some in people's own local
require "migrate"
class AddStatusToUser < ActiveRecord::Migration[4.2]
+ class User < ActiveRecord::Base
+ end
+
def self.up
create_enumeration :user_status_enum, %w[pending active confirmed suspended deleted]
class AddTermsSeenToUser < ActiveRecord::Migration[4.2]
+ class User < ActiveRecord::Base
+ end
+
def self.up
add_column :users, :terms_seen, :boolean, :null => false, :default => false
end
class MergeAclAddressAndMask < ActiveRecord::Migration[4.2]
+ class Acl < ActiveRecord::Base
+ end
+
def up
Acl.find_each do |acl|
address = IPAddr.new(acl.address)
class AddCounterCaches < ActiveRecord::Migration[4.2]
+ class Changeset < ActiveRecord::Base
+ end
+
+ class Trace < ActiveRecord::Base
+ self.table_name = "gpx_files"
+ end
+
def self.up
add_column :users, :changesets_count, :integer, :null => false, :default => 0
add_column :users, :traces_count, :integer, :null => false, :default => 0
class AddDiaryEntryCounterCaches < ActiveRecord::Migration[4.2]
+ class DiaryEntry < ActiveRecord::Base
+ end
+
+ class User < ActiveRecord::Base
+ end
+
def self.up
add_column :users, :diary_entries_count, :integer, :null => false, :default => 0
class AddImageUseGravatarToUsers < ActiveRecord::Migration[4.2]
+ class User < ActiveRecord::Base
+ end
+
def self.up
add_column :users, :image_use_gravatar, :boolean, :null => false, :default => false
class SubscribeOldChangesets < ActiveRecord::Migration[4.2]
+ class Changeset < ActiveRecord::Base
+ end
+
def up
Changeset.find_each do |changeset|
changeset.subscribers << changeset.user unless changeset.subscribers.exists?(changeset.user.id)
class RenameOpenidUrl < ActiveRecord::Migration[4.2]
+ class User < ActiveRecord::Base
+ end
+
def change
rename_column :users, :openid_url, :auth_uid
add_column :users, :auth_provider, :string
class SubscribeAuthorsToDiaryEntries < ActiveRecord::Migration[4.2]
+ class DiaryEntry < ActiveRecord::Base
+ end
+
def up
DiaryEntry.find_each do |diary_entry|
diary_entry.subscriptions.create(:user => diary_entry.user) unless diary_entry.subscribers.exists?(diary_entry.user.id)