Make all current migrations Rails 4.2 based

This commit is contained in:
Dennis Schubert 2017-08-07 15:20:15 +02:00 committed by Benjamin Neff
parent 1f272f5306
commit b614237504
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
70 changed files with 70 additions and 70 deletions

View file

@ -1,4 +1,4 @@
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"

View file

@ -1,4 +1,4 @@
class AddFacebookIdToPost < ActiveRecord::Migration
class AddFacebookIdToPost < ActiveRecord::Migration[4.2]
def change
add_column :posts, :facebook_id, :string
end

View file

@ -1,4 +1,4 @@
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

View file

@ -1,4 +1,4 @@
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 }

View file

@ -1,4 +1,4 @@
class AddOpenGraphCache < ActiveRecord::Migration
class AddOpenGraphCache < ActiveRecord::Migration[4.2]
def up
create_table :open_graph_caches do |t|
t.string :title

View file

@ -1,4 +1,4 @@
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'

View file

@ -1,4 +1,4 @@
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')

View file

@ -1,4 +1,4 @@
class AddTumblrPostIdsToPosts < ActiveRecord::Migration
class AddTumblrPostIdsToPosts < ActiveRecord::Migration[4.2]
def change
add_column :posts, :tumblr_ids, :text
end

View file

@ -1,4 +1,4 @@
class CreatePostReports < ActiveRecord::Migration
class CreatePostReports < ActiveRecord::Migration[4.2]
def change
create_table :post_reports do |t|
t.integer :post_id, :null => false

View file

@ -1,4 +1,4 @@
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

View file

@ -1,4 +1,4 @@
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

View file

@ -1,4 +1,4 @@
class RenamePostReportToReport < ActiveRecord::Migration
class RenamePostReportToReport < ActiveRecord::Migration[4.2]
def self.up
rename_table :post_reports, :reports
end

View file

@ -1,4 +1,4 @@
class DeviseAddLastseenableUser < ActiveRecord::Migration
class DeviseAddLastseenableUser < ActiveRecord::Migration[4.2]
def self.up
add_column :users, :last_seen, :datetime
User.find_each do |user|

View file

@ -1,4 +1,4 @@
class CreatePolls < ActiveRecord::Migration
class CreatePolls < ActiveRecord::Migration[4.2]
def up
create_table :polls do |t|
t.string :question, :null => false

View file

@ -1,4 +1,4 @@
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

View file

@ -1,4 +1,4 @@
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

View file

@ -1,5 +1,5 @@
# 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

View file

@ -1,4 +1,4 @@
class CreateChatContacts < ActiveRecord::Migration
class CreateChatContacts < ActiveRecord::Migration[4.2]
def up
create_table :chat_contacts do |t|
t.integer :user_id, null: false

View file

@ -1,4 +1,4 @@
class CreateChatFragments < ActiveRecord::Migration
class CreateChatFragments < ActiveRecord::Migration[4.2]
def up
create_table :chat_fragments do |t|
t.integer :user_id, null: false

View file

@ -1,4 +1,4 @@
class AddCompletedAtToAccountDeletions < ActiveRecord::Migration
class AddCompletedAtToAccountDeletions < ActiveRecord::Migration[4.2]
def change
add_column :account_deletions, :completed_at, :datetime
end

View file

@ -1,4 +1,4 @@
class IncreaseSimpleCaptchaLimit < ActiveRecord::Migration
class IncreaseSimpleCaptchaLimit < ActiveRecord::Migration[4.2]
def self.up
change_column :simple_captcha_data, :value, :string, :limit => 12
end

View file

@ -1,4 +1,4 @@
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

View file

@ -1,4 +1,4 @@
class AddRemoveAfterToUsers < ActiveRecord::Migration
class AddRemoveAfterToUsers < ActiveRecord::Migration[4.2]
def change
add_column :users, :remove_after, :datetime
end

View file

@ -1,4 +1,4 @@
class AddChatEnabledToAspects < ActiveRecord::Migration
class AddChatEnabledToAspects < ActiveRecord::Migration[4.2]
def self.up
add_column :aspects, :chat_enabled, :boolean, default: false
end

View file

@ -1,4 +1,4 @@
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

View file

@ -1,4 +1,4 @@
class DropOpenGraphCachesWithInvalidUrls < ActiveRecord::Migration
class DropOpenGraphCachesWithInvalidUrls < ActiveRecord::Migration[4.2]
def up
OpenGraphCache.where(url: 'http://').delete_all
end

View file

@ -1,4 +1,4 @@
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')

View file

@ -1,4 +1,4 @@
class AddExportToUser < ActiveRecord::Migration
class AddExportToUser < ActiveRecord::Migration[4.2]
def change
add_column :users, :export, :string
add_column :users, :exported_at, :datetime

View file

@ -1,4 +1,4 @@
class UserPrefStripExif < ActiveRecord::Migration
class UserPrefStripExif < ActiveRecord::Migration[4.2]
def up
add_column :users, :strip_exif, :boolean, default: true
end

View file

@ -1,4 +1,4 @@
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

View file

@ -1,4 +1,4 @@
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

View file

@ -1,4 +1,4 @@
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

View file

@ -1,4 +1,4 @@
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)

View file

@ -1,4 +1,4 @@
class FixWrongOnlySharing < ActiveRecord::Migration
class FixWrongOnlySharing < ActiveRecord::Migration[4.2]
def up
Contact.where(sharing: true, receiving: false)
.where(id: AspectMembership.select(:contact_id))

View file

@ -1,4 +1,4 @@
class EnableColorThemes < ActiveRecord::Migration
class EnableColorThemes < ActiveRecord::Migration[4.2]
def up
add_column(:users, :color_theme, :string)
end

View file

@ -1,4 +1,4 @@
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)

View file

@ -1,4 +1,4 @@
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

View file

@ -1,6 +1,6 @@
# 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

View file

@ -1,4 +1,4 @@
class AddPublicToProfiles < ActiveRecord::Migration
class AddPublicToProfiles < ActiveRecord::Migration[4.2]
def change
add_column :profiles, :public_details, :boolean, default: false
end

View file

@ -1,4 +1,4 @@
class CreateAuthorizations < ActiveRecord::Migration
class CreateAuthorizations < ActiveRecord::Migration[4.2]
def change
create_table :authorizations do |t|
t.belongs_to :user, index: true

View file

@ -1,6 +1,6 @@
# 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

View file

@ -1,6 +1,6 @@
# 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

View file

@ -1,4 +1,4 @@
class RemoveFavoritesFromPosts < ActiveRecord::Migration
class RemoveFavoritesFromPosts < ActiveRecord::Migration[4.2]
def self.up
remove_column :posts, :favorite
end

View file

@ -1,6 +1,6 @@
# 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

View file

@ -1,4 +1,4 @@
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)

View file

@ -1,4 +1,4 @@
class RemoveDuplicateAndEmptyPods < ActiveRecord::Migration
class RemoveDuplicateAndEmptyPods < ActiveRecord::Migration[4.2]
def up
remove_dupes
remove_empty_or_nil

View file

@ -1,4 +1,4 @@
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

View file

@ -1,4 +1,4 @@
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

View file

@ -1,4 +1,4 @@
class ExtendPods < ActiveRecord::Migration
class ExtendPods < ActiveRecord::Migration[4.2]
class Pod < ApplicationRecord
has_many :people

View file

@ -1,4 +1,4 @@
class LinkShareVisibilitiesWithUser < ActiveRecord::Migration
class LinkShareVisibilitiesWithUser < ActiveRecord::Migration[4.2]
class ShareVisibility < ApplicationRecord
end

View file

@ -1,4 +1,4 @@
class CleanupAspectVisibility < ActiveRecord::Migration
class CleanupAspectVisibility < ActiveRecord::Migration[4.2]
class AspectVisibility < ApplicationRecord
end

View file

@ -1,4 +1,4 @@
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

View file

@ -1,4 +1,4 @@
class AddAuthorIdIndexToParticipations < ActiveRecord::Migration
class AddAuthorIdIndexToParticipations < ActiveRecord::Migration[4.2]
def change
add_index :participations, :author_id, :using => :btree
end

View file

@ -1,4 +1,4 @@
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

View file

@ -1,4 +1,4 @@
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"

View file

@ -1,4 +1,4 @@
class CleanupParticipations < ActiveRecord::Migration
class CleanupParticipations < ActiveRecord::Migration[4.2]
class Participation < ApplicationRecord
end

View file

@ -1,4 +1,4 @@
class CreateSignatureTables < ActiveRecord::Migration
class CreateSignatureTables < ActiveRecord::Migration[4.2]
class SignatureOrder < ApplicationRecord
end

View file

@ -1,4 +1,4 @@
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}

View file

@ -1,4 +1,4 @@
class ParticipationCounter < ActiveRecord::Migration
class ParticipationCounter < ActiveRecord::Migration[4.2]
class Comment < ApplicationRecord
end

View file

@ -1,4 +1,4 @@
class CleanupInvitationColumnsFromUsers < ActiveRecord::Migration
class CleanupInvitationColumnsFromUsers < ActiveRecord::Migration[4.2]
class InvitationCode < ApplicationRecord
end

View file

@ -1,6 +1,6 @@
require_relative "20150714055110_create_id_tokens"
class RemoveIdTokens < ActiveRecord::Migration
class RemoveIdTokens < ActiveRecord::Migration[4.2]
def change
revert CreateIdTokens
end

View file

@ -1,4 +1,4 @@
class RemoveStartedSharingNotificationsWithoutContact < ActiveRecord::Migration
class RemoveStartedSharingNotificationsWithoutContact < ActiveRecord::Migration[4.2]
class Notification < ApplicationRecord
end

View file

@ -1,4 +1,4 @@
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

View file

@ -1,4 +1,4 @@
class AddVideoUrlToOpenGraphCache < ActiveRecord::Migration
class AddVideoUrlToOpenGraphCache < ActiveRecord::Migration[4.2]
def change
add_column :open_graph_caches, :video_url, :text
end

View file

@ -1,4 +1,4 @@
class RemoveInvalidUnconfirmedEmails < ActiveRecord::Migration
class RemoveInvalidUnconfirmedEmails < ActiveRecord::Migration[4.2]
class User < ApplicationRecord
end

View file

@ -1,4 +1,4 @@
class FixPhotosShareVisibilities < ActiveRecord::Migration
class FixPhotosShareVisibilities < ActiveRecord::Migration[4.2]
class Photo < ApplicationRecord
end

View file

@ -1,4 +1,4 @@
class RemoveEmptyPod < ActiveRecord::Migration
class RemoveEmptyPod < ActiveRecord::Migration[4.2]
def up
Pod.delete_all("host IS NULL")

View file

@ -1,4 +1,4 @@
class AddScheduledCheckToPod < ActiveRecord::Migration
class AddScheduledCheckToPod < ActiveRecord::Migration[4.2]
def change
add_column :pods, :scheduled_check, :boolean, default: false, null: false
end

View file

@ -1,4 +1,4 @@
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

View file

@ -1,4 +1,4 @@
class RemoveMessageSignature < ActiveRecord::Migration
class RemoveMessageSignature < ActiveRecord::Migration[4.2]
def change
remove_column :messages, :author_signature, :text
end