Unverified Commit b6142375 authored by Dennis Schubert's avatar Dennis Schubert Committed by Benjamin Neff

Make all current migrations Rails 4.2 based

parent 1f272f53
class CreateSchema < ActiveRecord::Migration
class CreateSchema < ActiveRecord::Migration[4.2]
create_table "account_deletions", :force => true do |t|
t.string "diaspora_handle"
t.integer "person_id"
......
class AddFacebookIdToPost < ActiveRecord::Migration
class AddFacebookIdToPost < ActiveRecord::Migration[4.2]
def change
add_column :posts, :facebook_id, :string
end
......
class FixDefaultImageUrlFromProfile < ActiveRecord::Migration
class FixDefaultImageUrlFromProfile < ActiveRecord::Migration[4.2]
def up
execute("UPDATE profiles SET image_url = REPLACE(image_url, 'images', 'assets'), image_url_small = REPLACE(image_url_small, 'images', 'assets'), image_url_medium = REPLACE(image_url_medium, 'images', 'assets') WHERE image_url LIKE '%images/user/default.png';")
end
......
class AddTweetIdToPost < ActiveRecord::Migration
class AddTweetIdToPost < ActiveRecord::Migration[4.2]
def change
add_column :posts, :tweet_id, :string
add_index :posts, ['tweet_id'], :length => { "tweet_id" => 191 }
......
class AddOpenGraphCache < ActiveRecord::Migration
class AddOpenGraphCache < ActiveRecord::Migration[4.2]
def up
create_table :open_graph_caches do |t|
t.string :title
......
class RemoveLimitFromRootGuidInPosts < ActiveRecord::Migration
class RemoveLimitFromRootGuidInPosts < ActiveRecord::Migration[4.2]
def up
remove_index 'posts', :name => 'index_posts_on_root_guid'
remove_index 'posts', :name => 'index_posts_on_author_id_and_root_guid'
......
class MigrateActivityStreamToStatusMessage < ActiveRecord::Migration
class MigrateActivityStreamToStatusMessage < ActiveRecord::Migration[4.2]
class Post < ApplicationRecord; self.inheritance_column = false; end
def up
posts_stream_photos = Post.where(type: 'ActivityStreams::Photo')
......
class AddTumblrPostIdsToPosts < ActiveRecord::Migration
class AddTumblrPostIdsToPosts < ActiveRecord::Migration[4.2]
def change
add_column :posts, :tumblr_ids, :text
end
......
class CreatePostReports < ActiveRecord::Migration
class CreatePostReports < ActiveRecord::Migration[4.2]
def change
create_table :post_reports do |t|
t.integer :post_id, :null => false
......
class CreateSimpleCaptchaData < ActiveRecord::Migration
class CreateSimpleCaptchaData < ActiveRecord::Migration[4.2]
def self.up
create_table :simple_captcha_data do |t|
t.string :key, :limit => 40
......
class AddPostTypeToPostReport < ActiveRecord::Migration
class AddPostTypeToPostReport < ActiveRecord::Migration[4.2]
def change
add_column :post_reports, :post_type, :string, :null => false, :after => :post_id, :default => 'post'
change_column_default :post_reports, :post_type, nil
......
class RenamePostReportToReport < ActiveRecord::Migration
class RenamePostReportToReport < ActiveRecord::Migration[4.2]
def self.up
rename_table :post_reports, :reports
end
......
class DeviseAddLastseenableUser < ActiveRecord::Migration
class DeviseAddLastseenableUser < ActiveRecord::Migration[4.2]
def self.up
add_column :users, :last_seen, :datetime
User.find_each do |user|
......
class CreatePolls < ActiveRecord::Migration
class CreatePolls < ActiveRecord::Migration[4.2]
def up
create_table :polls do |t|
t.string :question, :null => false
......
class RenamePostColumnsToItem < ActiveRecord::Migration
class RenamePostColumnsToItem < ActiveRecord::Migration[4.2]
def up
rename_column :reports, :post_id, :item_id
rename_column :reports, :post_type, :item_type
......
class ChangeUserIdTypeToInteger < ActiveRecord::Migration
class ChangeUserIdTypeToInteger < ActiveRecord::Migration[4.2]
def up
remove_column :reports, :user_id
add_column :reports, :user_id, :integer, :null => false, :default => 1
......
# This migration comes from acts_as_taggable_on_engine (originally 3)
class AddTaggingsCounterCacheToTags < ActiveRecord::Migration
class AddTaggingsCounterCacheToTags < ActiveRecord::Migration[4.2]
def self.up
add_column :tags, :taggings_count, :integer, default: 0
......
class CreateChatContacts < ActiveRecord::Migration
class CreateChatContacts < ActiveRecord::Migration[4.2]
def up
create_table :chat_contacts do |t|
t.integer :user_id, null: false
......
class CreateChatFragments < ActiveRecord::Migration
class CreateChatFragments < ActiveRecord::Migration[4.2]
def up
create_table :chat_fragments do |t|
t.integer :user_id, null: false
......
class AddCompletedAtToAccountDeletions < ActiveRecord::Migration
class AddCompletedAtToAccountDeletions < ActiveRecord::Migration[4.2]
def change
add_column :account_deletions, :completed_at, :datetime
end
......
class IncreaseSimpleCaptchaLimit < ActiveRecord::Migration
class IncreaseSimpleCaptchaLimit < ActiveRecord::Migration[4.2]
def self.up
change_column :simple_captcha_data, :value, :string, :limit => 12
end
......
class FixOpenGraphData < ActiveRecord::Migration
class FixOpenGraphData < ActiveRecord::Migration[4.2]
def self.up
change_column :open_graph_caches, :url, :text
change_column :open_graph_caches, :image, :text
......
class AddRemoveAfterToUsers < ActiveRecord::Migration
class AddRemoveAfterToUsers < ActiveRecord::Migration[4.2]
def change
add_column :users, :remove_after, :datetime
end
......
class AddChatEnabledToAspects < ActiveRecord::Migration
class AddChatEnabledToAspects < ActiveRecord::Migration[4.2]
def self.up
add_column :aspects, :chat_enabled, :boolean, default: false
end
......
class CreateChatOfflineMessages < ActiveRecord::Migration
class CreateChatOfflineMessages < ActiveRecord::Migration[4.2]
def self.up
create_table :chat_offline_messages do |t|
t.string :from, :null => false
......
class DropOpenGraphCachesWithInvalidUrls < ActiveRecord::Migration
class DropOpenGraphCachesWithInvalidUrls < ActiveRecord::Migration[4.2]
def up
OpenGraphCache.where(url: 'http://').delete_all
end
......
class PurgeOrphanConversations < ActiveRecord::Migration
class PurgeOrphanConversations < ActiveRecord::Migration[4.2]
def up
Conversation.where(id: Conversation.joins("LEFT JOIN conversation_visibilities ON conversation_visibilities.conversation_id = conversations.id")
.group('conversations.id')
......
class AddExportToUser < ActiveRecord::Migration
class AddExportToUser < ActiveRecord::Migration[4.2]
def change
add_column :users, :export, :string
add_column :users, :exported_at, :datetime
......
class UserPrefStripExif < ActiveRecord::Migration
class UserPrefStripExif < ActiveRecord::Migration[4.2]
def up
add_column :users, :strip_exif, :boolean, default: true
end
......
class SetMysqlToUnicodeMb4 < ActiveRecord::Migration
class SetMysqlToUnicodeMb4 < ActiveRecord::Migration[4.2]
# Converts the tables and strings columns to utf8mb4, which is the true, full
# unicode support in MySQl
......
class DisableMailForClosedAccount < ActiveRecord::Migration
class DisableMailForClosedAccount < ActiveRecord::Migration[4.2]
def up
User.joins(:person).where(people: {closed_account: true}).update_all(disable_mail: true)
end
......
class AddPhotosExportToUser < ActiveRecord::Migration
class AddPhotosExportToUser < ActiveRecord::Migration[4.2]
def up
add_column :users, :exported_photos_file, :string
add_column :users, :exported_photos_at, :datetime
......
class RemoveDeletedAspectsFromAutoFollowBack < ActiveRecord::Migration
class RemoveDeletedAspectsFromAutoFollowBack < ActiveRecord::Migration[4.2]
def up
User.where.not(auto_follow_back_aspect_id: Aspect.select(:id))
.where(auto_follow_back: true)
......
class FixWrongOnlySharing < ActiveRecord::Migration
class FixWrongOnlySharing < ActiveRecord::Migration[4.2]
def up
Contact.where(sharing: true, receiving: false)
.where(id: AspectMembership.select(:contact_id))
......
class EnableColorThemes < ActiveRecord::Migration
class EnableColorThemes < ActiveRecord::Migration[4.2]
def up
add_column(:users, :color_theme, :string)
end
......
class CleanupDefaultAvatars < ActiveRecord::Migration
class CleanupDefaultAvatars < ActiveRecord::Migration[4.2]
def up
Profile.where("image_url LIKE ?", "%user/default%")
.update_all(image_url: nil, image_url_small: nil, image_url_medium: nil)
......
class FixPhotoPublicFlag < ActiveRecord::Migration
class FixPhotoPublicFlag < ActiveRecord::Migration[4.2]
def up
Photo.joins(:status_message).where(posts: {public: true}).update_all(public: true)
end
......
# Inspired by https://github.com/nov/openid_connect_sample/blob/master/db/migrate/20110829023826_create_clients.rb
class CreateOAuthApplications < ActiveRecord::Migration
class CreateOAuthApplications < ActiveRecord::Migration[4.2]
def change
create_table :o_auth_applications do |t|
t.belongs_to :user, index: true
......
class AddPublicToProfiles < ActiveRecord::Migration
class AddPublicToProfiles < ActiveRecord::Migration[4.2]
def change
add_column :profiles, :public_details, :boolean, default: false
end
......
class CreateAuthorizations < ActiveRecord::Migration
class CreateAuthorizations < ActiveRecord::Migration[4.2]
def change
create_table :authorizations do |t|
t.belongs_to :user, index: true
......
# Inspired by https://github.com/nov/openid_connect_sample/blob/master/db/migrate/20110829023837_create_access_tokens.rb
class CreateOAuthAccessTokens < ActiveRecord::Migration
class CreateOAuthAccessTokens < ActiveRecord::Migration[4.2]
def change
create_table :o_auth_access_tokens do |t|
t.belongs_to :authorization, index: true
......
# Inspired by https://github.com/nov/openid_connect_sample/blob/master/db/migrate/20110829024010_create_id_tokens.rb
class CreateIdTokens < ActiveRecord::Migration
class CreateIdTokens < ActiveRecord::Migration[4.2]
def change
create_table :id_tokens do |t|
t.belongs_to :authorization, index: true
......
class RemoveFavoritesFromPosts < ActiveRecord::Migration
class RemoveFavoritesFromPosts < ActiveRecord::Migration[4.2]
def self.up
remove_column :posts, :favorite
end
......
# Inspired by https://github.com/nov/openid_connect_sample/blob/master/db/migrate/20110829024140_create_pairwise_pseudonymous_identifiers.rb
class CreatePairwisePseudonymousIdentifiers < ActiveRecord::Migration
class CreatePairwisePseudonymousIdentifiers < ActiveRecord::Migration[4.2]
def change
create_table :ppid do |t|
t.belongs_to :o_auth_application, index: true
......
class AddStatusToPods < ActiveRecord::Migration
class AddStatusToPods < ActiveRecord::Migration[4.2]
def change
add_column :pods, :status, :integer, default: 0
add_column :pods, :checked_at, :datetime, default: Time.zone.at(0)
......
class RemoveDuplicateAndEmptyPods < ActiveRecord::Migration
class RemoveDuplicateAndEmptyPods < ActiveRecord::Migration[4.2]
def up
remove_dupes
remove_empty_or_nil
......
class UpdateReportItemTypes < ActiveRecord::Migration
class UpdateReportItemTypes < ActiveRecord::Migration[4.2]
def change
Report.all.each do |report|
report.update_attribute :item_type, report[:item_type].capitalize
......
class RemoveSignaturesFromRelayables < ActiveRecord::Migration
class RemoveSignaturesFromRelayables < ActiveRecord::Migration[4.2]
def change
remove_column :comments, :parent_author_signature, :text
remove_column :poll_participations, :parent_author_signature, :text
......
class ExtendPods < ActiveRecord::Migration
class ExtendPods < ActiveRecord::Migration[4.2]
class Pod < ApplicationRecord
has_many :people
......
class LinkShareVisibilitiesWithUser < ActiveRecord::Migration
class LinkShareVisibilitiesWithUser < ActiveRecord::Migration[4.2]
class ShareVisibility < ApplicationRecord
end
......
class CleanupAspectVisibility < ActiveRecord::Migration
class CleanupAspectVisibility < ActiveRecord::Migration[4.2]
class AspectVisibility < ApplicationRecord
end
......
class CleanupHandles < ActiveRecord::Migration
class CleanupHandles < ActiveRecord::Migration[4.2]
def change
remove_column :photos, :tmp_old_id, :integer
remove_column :photos, :diaspora_handle, :string
......
class AddAuthorIdIndexToParticipations < ActiveRecord::Migration
class AddAuthorIdIndexToParticipations < ActiveRecord::Migration[4.2]
def change
add_index :participations, :author_id, :using => :btree
end
......
class CleanupDuplicatesAndAddUniqueIndexes < ActiveRecord::Migration
class CleanupDuplicatesAndAddUniqueIndexes < ActiveRecord::Migration[4.2]
def up
# temporary index to speed up the migration
add_index :photos, :guid, length: 191
......
class RemoveDuplicateAspectVisibilities < ActiveRecord::Migration
class RemoveDuplicateAspectVisibilities < ActiveRecord::Migration[4.2]
def up
where = "WHERE a1.aspect_id = a2.aspect_id AND a1.shareable_id = a2.shareable_id AND "\
"a1.shareable_type = a2.shareable_type AND a1.id > a2.id"
......
class CleanupParticipations < ActiveRecord::Migration
class CleanupParticipations < ActiveRecord::Migration[4.2]
class Participation < ApplicationRecord
end
......
class CreateSignatureTables < ActiveRecord::Migration
class CreateSignatureTables < ActiveRecord::Migration[4.2]
class SignatureOrder < ApplicationRecord
end
......
class CleanupPostsTable < ActiveRecord::Migration
class CleanupPostsTable < ActiveRecord::Migration[4.2]
def change
remove_index :posts, column: %i(status_message_guid pending),
name: :index_posts_on_status_message_guid_and_pending, length: {status_message_guid: 190}
......
class ParticipationCounter < ActiveRecord::Migration
class ParticipationCounter < ActiveRecord::Migration[4.2]
class Comment < ApplicationRecord
end
......
class CleanupInvitationColumnsFromUsers < ActiveRecord::Migration
class CleanupInvitationColumnsFromUsers < ActiveRecord::Migration[4.2]
class InvitationCode < ApplicationRecord
end
......
require_relative "20150714055110_create_id_tokens"
class RemoveIdTokens < ActiveRecord::Migration
class RemoveIdTokens < ActiveRecord::Migration[4.2]
def change
revert CreateIdTokens
end
......
class RemoveStartedSharingNotificationsWithoutContact < ActiveRecord::Migration
class RemoveStartedSharingNotificationsWithoutContact < ActiveRecord::Migration[4.2]
class Notification < ApplicationRecord
end
......
class AddPostDefaultToAspects < ActiveRecord::Migration
class AddPostDefaultToAspects < ActiveRecord::Migration[4.2]
def change
add_column :aspects, :post_default, :boolean, default: true
add_column :users, :post_default_public, :boolean, default: false
......
class AddVideoUrlToOpenGraphCache < ActiveRecord::Migration
class AddVideoUrlToOpenGraphCache < ActiveRecord::Migration[4.2]
def change
add_column :open_graph_caches, :video_url, :text
end
......
class RemoveInvalidUnconfirmedEmails < ActiveRecord::Migration
class RemoveInvalidUnconfirmedEmails < ActiveRecord::Migration[4.2]
class User < ApplicationRecord
end
......
class FixPhotosShareVisibilities < ActiveRecord::Migration
class FixPhotosShareVisibilities < ActiveRecord::Migration[4.2]
class Photo < ApplicationRecord
end
......
class RemoveEmptyPod < ActiveRecord::Migration
class RemoveEmptyPod < ActiveRecord::Migration[4.2]
def up
Pod.delete_all("host IS NULL")
......
class AddScheduledCheckToPod < ActiveRecord::Migration
class AddScheduledCheckToPod < ActiveRecord::Migration[4.2]
def change
add_column :pods, :scheduled_check, :boolean, default: false, null: false
end
......
class PolymorphicMentions < ActiveRecord::Migration
class PolymorphicMentions < ActiveRecord::Migration[4.2]
def change
remove_index :mentions, column: %i(post_id)
remove_index :mentions, column: %i(person_id post_id), unique: true
......
class RemoveMessageSignature < ActiveRecord::Migration
class RemoveMessageSignature < ActiveRecord::Migration[4.2]
def change
remove_column :messages, :author_signature, :text
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment