require "migrate"
-class CreateOsmDb < ActiveRecord::Migration[5.0]
+class CreateOsmDb < ActiveRecord::Migration[4.2]
def self.up
create_table "current_nodes", :id => false do |t|
t.column "id", :bigint, :null => false
require "migrate"
-class CleanupOsmDb < ActiveRecord::Migration[5.0]
+class CleanupOsmDb < ActiveRecord::Migration[4.2]
def self.up
change_column "current_nodes", "latitude", :float, :limit => 53, :null => false
change_column "current_nodes", "longitude", :float, :limit => 53, :null => false
require "migrate"
-class SqlSessionStoreSetup < ActiveRecord::Migration[5.0]
+class SqlSessionStoreSetup < ActiveRecord::Migration[4.2]
def self.up
create_table "sessions" do |t|
t.column "session_id", :string
require "migrate"
-class UserEnhancements < ActiveRecord::Migration[5.0]
+class UserEnhancements < ActiveRecord::Migration[4.2]
def self.up
add_column "diary_entries", "latitude", :float, :limit => 53
add_column "diary_entries", "longitude", :float, :limit => 53
require "migrate"
-class TileTracepoints < ActiveRecord::Migration[5.0]
+class TileTracepoints < ActiveRecord::Migration[4.2]
def self.up
add_column "gps_points", "tile", :bigint
add_index "gps_points", ["tile"], :name => "points_tile_idx"
require "migrate"
-class TileNodes < ActiveRecord::Migration[5.0]
+class TileNodes < ActiveRecord::Migration[4.2]
def self.upgrade_table(from_table, to_table, model)
if ENV["USE_DB_FUNCTIONS"]
execute <<-SQL
require "migrate"
-class AddRelations < ActiveRecord::Migration[5.0]
+class AddRelations < ActiveRecord::Migration[4.2]
def self.up
# enums work like strings but are more efficient
create_enumeration :nwr_enum, %w[Node Way Relation]
require "migrate"
-class RemoveSegments < ActiveRecord::Migration[5.0]
+class RemoveSegments < ActiveRecord::Migration[4.2]
def self.up
have_segs = select_value("SELECT count(*) FROM current_segments").to_i.nonzero?
-class WayNodesNodeIdx < ActiveRecord::Migration[5.0]
+class WayNodesNodeIdx < ActiveRecord::Migration[4.2]
def self.up
add_index "way_nodes", ["node_id"], :name => "way_nodes_node_idx"
end
require "migrate"
-class DiaryComments < ActiveRecord::Migration[5.0]
+class DiaryComments < ActiveRecord::Migration[4.2]
def self.up
create_table "diary_comments", :id => false do |t|
t.column "id", :bigserial, :primary_key => true, :null => false
-class AddUserImage < ActiveRecord::Migration[5.0]
+class AddUserImage < ActiveRecord::Migration[4.2]
def self.up
add_column "users", "image", :text
end
-class AddAdminFlag < ActiveRecord::Migration[5.0]
+class AddAdminFlag < ActiveRecord::Migration[4.2]
def self.up
add_column "users", "administrator", :boolean, :default => false, :null => false
end
-class AddEmailValid < ActiveRecord::Migration[5.0]
+class AddEmailValid < ActiveRecord::Migration[4.2]
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
-class AddNewEmail < ActiveRecord::Migration[5.0]
+class AddNewEmail < ActiveRecord::Migration[4.2]
def self.up
add_column "users", "new_email", :string
end
-class AddUserVisible < ActiveRecord::Migration[5.0]
+class AddUserVisible < ActiveRecord::Migration[4.2]
def self.up
add_column "users", "visible", :boolean, :default => true, :null => false
User.update_all(:visible => true)
-class AddCreationIp < ActiveRecord::Migration[5.0]
+class AddCreationIp < ActiveRecord::Migration[4.2]
def self.up
add_column "users", "creation_ip", :string
end
-class AddGpxIndexes < ActiveRecord::Migration[5.0]
+class AddGpxIndexes < ActiveRecord::Migration[4.2]
def self.up
add_index "gpx_files", ["user_id"], :name => "gpx_files_user_id_idx"
add_index "gpx_file_tags", ["tag"], :name => "gpx_file_tags_tag_idx"
require "migrate"
-class CreateAcls < ActiveRecord::Migration[5.0]
+class CreateAcls < ActiveRecord::Migration[4.2]
def self.up
create_table "acls", :id => false do |t|
t.column "id", :primary_key, :null => false
-class AddTimestampIndexes < ActiveRecord::Migration[5.0]
+class AddTimestampIndexes < ActiveRecord::Migration[4.2]
def self.up
add_index :current_ways, :timestamp, :name => :current_ways_timestamp_idx
add_index :current_relations, :timestamp, :name => :current_relations_timestamp_idx
require "migrate"
-class PopulateNodeTagsAndRemove < ActiveRecord::Migration[5.0]
+class PopulateNodeTagsAndRemove < ActiveRecord::Migration[4.2]
def self.up
have_nodes = select_value("SELECT count(*) FROM current_nodes").to_i.nonzero?
require "migrate"
-class MoveToInnodb < ActiveRecord::Migration[5.0]
+class MoveToInnodb < ActiveRecord::Migration[4.2]
@conv_tables = %w[nodes ways way_tags way_nodes current_way_tags relation_members relations relation_tags current_relation_tags]
@ver_tbl = %w[nodes ways relations]
require "migrate"
-class KeyConstraints < ActiveRecord::Migration[5.0]
+class KeyConstraints < ActiveRecord::Migration[4.2]
def self.up
# Primary keys
add_primary_key :current_node_tags, [:id, :k]
require "migrate"
-class AddChangesets < ActiveRecord::Migration[5.0]
+class AddChangesets < ActiveRecord::Migration[4.2]
@conv_user_tables = %w[current_nodes current_relations current_ways nodes relations ways]
def self.up
require "migrate"
-class OrderRelationMembers < ActiveRecord::Migration[5.0]
+class OrderRelationMembers < ActiveRecord::Migration[4.2]
def self.up
# add sequence column. rails won't let us define an ordering here,
# as defaults must be constant.
require "migrate"
-class AddEndTimeToChangesets < ActiveRecord::Migration[5.0]
+class AddEndTimeToChangesets < ActiveRecord::Migration[4.2]
def self.up
# swap the boolean closed-or-not for a time when the changeset will
# close or has closed.
-class AddChangesetUserIndex < ActiveRecord::Migration[5.0]
+class AddChangesetUserIndex < ActiveRecord::Migration[4.2]
def self.up
add_index "changesets", ["user_id"], :name => "changesets_user_id_idx"
end
-class AddChangesetIndexes < ActiveRecord::Migration[5.0]
+class AddChangesetIndexes < ActiveRecord::Migration[4.2]
def self.up
add_index "nodes", ["changeset_id"], :name => "nodes_changeset_id_idx"
add_index "ways", ["changeset_id"], :name => "ways_changeset_id_idx"
require "migrate"
-class AddMoreChangesetIndexes < ActiveRecord::Migration[5.0]
+class AddMoreChangesetIndexes < ActiveRecord::Migration[4.2]
def self.up
add_index "changesets", ["created_at"], :name => "changesets_created_at_idx"
add_index "changesets", ["closed_at"], :name => "changesets_closed_at_idx"
require "migrate"
-class AddUserForeignKeys < ActiveRecord::Migration[5.0]
+class AddUserForeignKeys < ActiveRecord::Migration[4.2]
def change
add_foreign_key :changesets, :users, :name => "changesets_user_id_fkey"
add_foreign_key :diary_comments, :users, :name => "diary_comments_user_id_fkey"
require "migrate"
-class AddForeignKeys < ActiveRecord::Migration[5.0]
+class AddForeignKeys < ActiveRecord::Migration[4.2]
def self.up
add_foreign_key :changeset_tags, :changesets, :column => :id, :name => "changeset_tags_id_fkey"
add_foreign_key :diary_comments, :diary_entries, :name => "diary_comments_diary_entry_id_fkey"
require "migrate"
require "rexml/document"
-class CreateCountries < ActiveRecord::Migration[5.0]
+class CreateCountries < ActiveRecord::Migration[4.2]
def self.up
create_table :countries, :id => false do |t|
t.column :id, :primary_key, :null => false
-class AddUserLocale < ActiveRecord::Migration[5.0]
+class AddUserLocale < ActiveRecord::Migration[4.2]
def self.up
add_column "users", "locale", :string
end
-class ChangeDiaryEntriesLanguage < ActiveRecord::Migration[5.0]
+class ChangeDiaryEntriesLanguage < ActiveRecord::Migration[4.2]
def self.up
remove_column "diary_entries", "language"
add_column "diary_entries", "language_code", :string, :null => false, :default => "en"
require "migrate"
-class CreateLanguages < ActiveRecord::Migration[5.0]
+class CreateLanguages < ActiveRecord::Migration[4.2]
def change
create_table :languages, :id => false do |t|
t.string :code, :null => false
require "migrate"
-class ChangeUserLocale < ActiveRecord::Migration[5.0]
+class ChangeUserLocale < ActiveRecord::Migration[4.2]
def self.up
remove_foreign_key :users, :column => :locale, :name => "users_locale_fkey"
-class AddVisibleToMessage < ActiveRecord::Migration[5.0]
+class AddVisibleToMessage < ActiveRecord::Migration[4.2]
def self.up
add_column :messages, :visible, :boolean, :default => true, :null => false
end
-class AddSenderVisibleToMessage < ActiveRecord::Migration[5.0]
+class AddSenderVisibleToMessage < ActiveRecord::Migration[4.2]
def self.up
rename_column :messages, :visible, :to_user_visible
add_column :messages, :from_user_visible, :boolean, :default => true, :null => false
-class AddMessageSenderIndex < ActiveRecord::Migration[5.0]
+class AddMessageSenderIndex < ActiveRecord::Migration[4.2]
def self.up
add_index :messages, [:from_user_id], :name => "messages_from_user_id_idx"
end
require "migrate"
-class AddMoreControlsToGpxFiles < ActiveRecord::Migration[5.0]
+class AddMoreControlsToGpxFiles < ActiveRecord::Migration[4.2]
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
-class CreateOauthTables < ActiveRecord::Migration[5.0]
+class CreateOauthTables < ActiveRecord::Migration[4.2]
def self.up
create_table :client_applications do |t|
t.string :name
-class AddFineOAuthPermissions < ActiveRecord::Migration[5.0]
+class AddFineOAuthPermissions < ActiveRecord::Migration[4.2]
PERMISSIONS = [:allow_read_prefs, :allow_write_prefs, :allow_write_diary, :allow_write_api, :allow_read_gpx, :allow_write_gpx].freeze
def self.up
require "migrate"
-class AddForeignKeysToOauthTables < ActiveRecord::Migration[5.0]
+class AddForeignKeysToOauthTables < ActiveRecord::Migration[4.2]
def change
add_foreign_key :oauth_tokens, :users, :name => "oauth_tokens_user_id_fkey"
add_foreign_key :oauth_tokens, :client_applications, :name => "oauth_tokens_client_application_id_fkey"
-class AddRefererToUserToken < ActiveRecord::Migration[5.0]
+class AddRefererToUserToken < ActiveRecord::Migration[4.2]
def self.up
add_column :user_tokens, :referer, :text
end
require "migrate"
-class CreateUserRoles < ActiveRecord::Migration[5.0]
+class CreateUserRoles < ActiveRecord::Migration[4.2]
def self.up
create_enumeration :user_role_enum, %w[administrator moderator]
require "migrate"
-class CreateUserBlocks < ActiveRecord::Migration[5.0]
+class CreateUserBlocks < ActiveRecord::Migration[4.2]
def change
create_table :user_blocks do |t|
t.column :user_id, :bigint, :null => false
require "migrate"
-class AlterUserRolesAndBlocks < ActiveRecord::Migration[5.0]
+class AlterUserRolesAndBlocks < ActiveRecord::Migration[4.2]
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
-class AddVisibleToDiaries < ActiveRecord::Migration[5.0]
+class AddVisibleToDiaries < ActiveRecord::Migration[4.2]
def self.up
add_column :diary_entries, :visible, :boolean, :null => false, :default => true
add_column :diary_comments, :visible, :boolean, :null => false, :default => true
-class AddDiaryCreationIndexes < ActiveRecord::Migration[5.0]
+class AddDiaryCreationIndexes < ActiveRecord::Migration[4.2]
def self.up
add_index :diary_entries, [:created_at], :name => "diary_entry_created_at_index"
add_index :diary_entries, [:user_id, :created_at], :name => "diary_entry_user_id_created_at_index"
-class ImproveChangesetUserIndex < ActiveRecord::Migration[5.0]
+class ImproveChangesetUserIndex < ActiveRecord::Migration[4.2]
def self.up
add_index :changesets, [:user_id, :id], :name => "changesets_user_id_id_idx"
remove_index :changesets, :name => "changesets_user_id_idx"
-class AddUserIndexToDiaryComments < ActiveRecord::Migration[5.0]
+class AddUserIndexToDiaryComments < ActiveRecord::Migration[4.2]
def self.up
add_index :diary_comments, [:user_id, :created_at], :name => "diary_comment_user_id_created_at_index"
end
require "migrate"
-class AddStatusToUser < ActiveRecord::Migration[5.0]
+class AddStatusToUser < ActiveRecord::Migration[4.2]
def self.up
create_enumeration :user_status_enum, %w[pending active confirmed suspended deleted]
-class AddContributorTermsToUser < ActiveRecord::Migration[5.0]
+class AddContributorTermsToUser < ActiveRecord::Migration[4.2]
def self.up
add_column :users, :terms_agreed, :datetime
add_column :users, :consider_pd, :boolean, :null => false, :default => false
require "migrate"
-class AddMapBugTables < ActiveRecord::Migration[5.0]
+class AddMapBugTables < ActiveRecord::Migration[4.2]
def self.up
create_enumeration :map_bug_status_enum, %w[open closed hidden]
require "migrate"
-class RefactorMapBugTables < ActiveRecord::Migration[5.0]
+class RefactorMapBugTables < ActiveRecord::Migration[4.2]
def self.up
create_table :map_bug_comment do |t|
t.column :bug_id, :bigint, :null => false
require "migrate"
-class ChangeMapBugCommentType < ActiveRecord::Migration[5.0]
+class ChangeMapBugCommentType < ActiveRecord::Migration[4.2]
def self.up
change_column :map_bug_comment, :comment, :text
end
require "migrate"
-class AddDateClosed < ActiveRecord::Migration[5.0]
+class AddDateClosed < ActiveRecord::Migration[4.2]
def self.up
add_column :map_bugs, :date_closed, :timestamp
end
require "migrate"
-class AddMapBugCommentEvent < ActiveRecord::Migration[5.0]
+class AddMapBugCommentEvent < ActiveRecord::Migration[4.2]
def self.up
create_enumeration :map_bug_event_enum, %w[opened closed reopened commented hidden]
-class AddUserDateIndexToChangeset < ActiveRecord::Migration[5.0]
+class AddUserDateIndexToChangeset < ActiveRecord::Migration[4.2]
def self.up
add_index :changesets, [:user_id, :created_at], :name => "changesets_user_id_created_at_idx"
end
-class AddOpenId < ActiveRecord::Migration[5.0]
+class AddOpenId < ActiveRecord::Migration[4.2]
def self.up
add_column :users, :openid_url, :string
add_index :users, [:openid_url], :name => "user_openid_url_idx", :unique => true
-class AddCallbackToOauthTokens < ActiveRecord::Migration[5.0]
+class AddCallbackToOauthTokens < ActiveRecord::Migration[4.2]
def self.up
add_column :oauth_tokens, :callback_url, :string
add_column :oauth_tokens, :verifier, :string, :limit => 20
-class AddEditorPreferenceToUser < ActiveRecord::Migration[5.0]
+class AddEditorPreferenceToUser < ActiveRecord::Migration[4.2]
def self.up
add_column :users, :preferred_editor, :string
end
-class AddTermsSeenToUser < ActiveRecord::Migration[5.0]
+class AddTermsSeenToUser < ActiveRecord::Migration[4.2]
def self.up
add_column :users, :terms_seen, :boolean, :null => false, :default => false
-class CleanupBugTables < ActiveRecord::Migration[5.0]
+class CleanupBugTables < ActiveRecord::Migration[4.2]
def self.up
rename_column :map_bugs, :date_created, :created_at
rename_column :map_bugs, :last_changed, :updated_at
require "migrate"
-class RenameBugsToNotes < ActiveRecord::Migration[5.0]
+class RenameBugsToNotes < ActiveRecord::Migration[4.2]
def self.up
rename_enumeration "map_bug_status_enum", "note_status_enum"
rename_enumeration "map_bug_event_enum", "note_event_enum"
-class RenameIds < ActiveRecord::Migration[5.0]
+class RenameIds < ActiveRecord::Migration[4.2]
def change
rename_column :changeset_tags, :id, :changeset_id
rename_column :current_node_tags, :id, :node_id
-class UpdateOauth < ActiveRecord::Migration[5.0]
+class UpdateOauth < ActiveRecord::Migration[4.2]
def up
add_column :oauth_tokens, :scope, :string
add_column :oauth_tokens, :valid_to, :timestamp
require "migrate"
-class AddLowercaseUserIndexes < ActiveRecord::Migration[5.0]
+class AddLowercaseUserIndexes < ActiveRecord::Migration[4.2]
def up
add_index :users, [], :columns => "LOWER(display_name)", :name => "users_display_name_lower_idx"
add_index :users, [], :columns => "LOWER(email)", :name => "users_email_lower_idx"
-class SwitchToPaperclip < ActiveRecord::Migration[5.0]
+class SwitchToPaperclip < ActiveRecord::Migration[4.2]
def up
rename_column :users, :image, :image_file_name
end
end
end
-class MergeAclAddressAndMask < ActiveRecord::Migration[5.0]
+class MergeAclAddressAndMask < ActiveRecord::Migration[4.2]
def up
Acl.find_each do |acl|
address = IPAddr.new(acl.address)
-class AddDomainToAcl < ActiveRecord::Migration[5.0]
+class AddDomainToAcl < ActiveRecord::Migration[4.2]
def up
add_column :acls, :domain, :string
change_column :acls, :address, :inet, :null => true
require "migrate"
-class AddTextFormat < ActiveRecord::Migration[5.0]
+class AddTextFormat < ActiveRecord::Migration[4.2]
def up
create_enumeration :format_enum, %w[html markdown text]
add_column :users, :description_format, :format_enum, :null => false, :default => "html"
-class AddUserImageFingerprint < ActiveRecord::Migration[5.0]
+class AddUserImageFingerprint < ActiveRecord::Migration[4.2]
def up
add_column :users, :image_fingerprint, :string, :null => true
require "migrate"
-class CreateRedactions < ActiveRecord::Migration[5.0]
+class CreateRedactions < ActiveRecord::Migration[4.2]
def change
create_table :redactions do |t|
t.string :title
require "migrate"
-class DropSessionTable < ActiveRecord::Migration[5.0]
+class DropSessionTable < ActiveRecord::Migration[4.2]
def up
drop_table "sessions"
end
require "migrate"
-class AddUserAndDescriptionToRedaction < ActiveRecord::Migration[5.0]
+class AddUserAndDescriptionToRedaction < ActiveRecord::Migration[4.2]
def change
add_column :redactions, :user_id, :bigint, :null => false
add_column :redactions, :description_format, :format_enum, :null => false, :default => "markdown"
-class AddCounterCaches < ActiveRecord::Migration[5.0]
+class AddCounterCaches < ActiveRecord::Migration[4.2]
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[5.0]
+class AddDiaryEntryCounterCaches < ActiveRecord::Migration[4.2]
def self.up
add_column :users, :diary_entries_count, :integer, :null => false, :default => 0
-class AddImageUseGravatarToUsers < ActiveRecord::Migration[5.0]
+class AddImageUseGravatarToUsers < ActiveRecord::Migration[4.2]
def self.up
add_column :users, :image_use_gravatar, :boolean, :null => false, :default => false
-class DropNearbyPlaceFromNotes < ActiveRecord::Migration[5.0]
+class DropNearbyPlaceFromNotes < ActiveRecord::Migration[4.2]
def up
remove_column :notes, :nearby_place
end
-class RemoveAuthorNameFromNoteComment < ActiveRecord::Migration[5.0]
+class RemoveAuthorNameFromNoteComment < ActiveRecord::Migration[4.2]
def up
remove_column :note_comments, :author_name
end
-class ChangeNoteAddressToInet < ActiveRecord::Migration[5.0]
+class ChangeNoteAddressToInet < ActiveRecord::Migration[4.2]
def up
execute "ALTER TABLE note_comments ALTER COLUMN author_ip TYPE inet USING CAST(author_ip AS inet)"
end
-class AddWriteNotesPermission < ActiveRecord::Migration[5.0]
+class AddWriteNotesPermission < ActiveRecord::Migration[4.2]
def up
add_column :oauth_tokens, :allow_write_notes, :boolean, :null => false, :default => false
add_column :client_applications, :allow_write_notes, :boolean, :null => false, :default => false
-class AddCreatedAtIndexToNoteComments < ActiveRecord::Migration[5.0]
+class AddCreatedAtIndexToNoteComments < ActiveRecord::Migration[4.2]
def change
add_index :note_comments, :created_at
end
require "migrate"
-class AddTextIndexToNoteComments < ActiveRecord::Migration[5.0]
+class AddTextIndexToNoteComments < ActiveRecord::Migration[4.2]
def up
add_index :note_comments, [], :columns => "to_tsvector('english', body)", :using => "GIN", :name => "index_note_comments_on_body"
end
-class DropCountries < ActiveRecord::Migration[5.0]
+class DropCountries < ActiveRecord::Migration[4.2]
def up
drop_table :countries
end
-class AddUserImageContentType < ActiveRecord::Migration[5.0]
+class AddUserImageContentType < ActiveRecord::Migration[4.2]
def change
add_column :users, :image_content_type, :string
end
require "migrate"
-class CreateChangesetComments < ActiveRecord::Migration[5.0]
+class CreateChangesetComments < ActiveRecord::Migration[4.2]
def change
create_table :changeset_comments do |t|
t.column :changeset_id, :bigint, :null => false
require "migrate"
-class AddJoinTableBetweenUsersAndChangesets < ActiveRecord::Migration[5.0]
+class AddJoinTableBetweenUsersAndChangesets < ActiveRecord::Migration[4.2]
def change
create_table :changesets_subscribers, :id => false do |t|
t.column :subscriber_id, :bigint, :null => false
-class ChangeDefaultFormats < ActiveRecord::Migration[5.0]
+class ChangeDefaultFormats < ActiveRecord::Migration[4.2]
def up
change_column_default :diary_entries, :body_format, "markdown"
change_column_default :diary_comments, :body_format, "markdown"
-class SubscribeOldChangesets < ActiveRecord::Migration[5.0]
+class SubscribeOldChangesets < ActiveRecord::Migration[4.2]
def up
Changeset.find_each do |changeset|
changeset.subscribers << changeset.user unless changeset.subscribers.exists?(changeset.user.id)
-class RenameOpenidUrl < ActiveRecord::Migration[5.0]
+class RenameOpenidUrl < ActiveRecord::Migration[4.2]
def change
rename_column :users, :openid_url, :auth_uid
add_column :users, :auth_provider, :string
-class SetDefaultGravatarToFalseForPrivacy < ActiveRecord::Migration[5.0]
+class SetDefaultGravatarToFalseForPrivacy < ActiveRecord::Migration[4.2]
def up
change_column :users, :image_use_gravatar, :boolean, :default => false
end
require "migrate"
-class AddJoinTableBetweenUsersAndDiaryEntries < ActiveRecord::Migration[5.0]
+class AddJoinTableBetweenUsersAndDiaryEntries < ActiveRecord::Migration[4.2]
def self.up
create_table :diary_entry_subscriptions, :id => false do |t|
t.column :user_id, :bigint, :null => false
-class SubscribeAuthorsToDiaryEntries < ActiveRecord::Migration[5.0]
+class SubscribeAuthorsToDiaryEntries < ActiveRecord::Migration[4.2]
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)
-class AddUserIndexes < ActiveRecord::Migration[5.0]
+class AddUserIndexes < ActiveRecord::Migration[4.2]
def change
add_index :oauth_tokens, [:user_id]
add_index :client_applications, [:user_id]