Update deprecated enum style in older migrations (#32925)
				
					
				
			This commit is contained in:
		@@ -3,7 +3,7 @@
 | 
			
		||||
class AddTypeToMediaAttachments < ActiveRecord::Migration[5.0]
 | 
			
		||||
  class MigrationMediaAttachment < ApplicationRecord
 | 
			
		||||
    self.table_name = :media_attachments
 | 
			
		||||
    enum type: [:image, :gifv, :video]
 | 
			
		||||
    enum :type, [:image, :gifv, :video]
 | 
			
		||||
    IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif'].freeze
 | 
			
		||||
    VIDEO_MIME_TYPES = ['video/webm', 'video/mp4'].freeze
 | 
			
		||||
  end
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@ class MigrateAccountConversations < ActiveRecord::Migration[5.2]
 | 
			
		||||
    belongs_to :account, class_name: 'MigrationAccount'
 | 
			
		||||
    has_many :mentions, dependent: :destroy, inverse_of: :status, class_name: 'MigrationMention', foreign_key: :status_id
 | 
			
		||||
    scope :local, -> { where(local: true).or(where(uri: nil)) }
 | 
			
		||||
    enum visibility: { public: 0, unlisted: 1, private: 2, direct: 3, limited: 4 }, _suffix: :visibility
 | 
			
		||||
    enum :visibility, { public: 0, unlisted: 1, private: 2, direct: 3, limited: 4 }, suffix: :visibility
 | 
			
		||||
    has_many :active_mentions, -> { active }, class_name: 'MigrationMention', inverse_of: :status, foreign_key: :status_id
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ class AddSilencedAtSuspendedAtToAccounts < ActiveRecord::Migration[5.2]
 | 
			
		||||
 | 
			
		||||
  class DomainBlock < ApplicationRecord
 | 
			
		||||
    # Dummy class, to make migration possible across version changes
 | 
			
		||||
    enum severity: [:silence, :suspend, :noop]
 | 
			
		||||
    enum :severity, [:silence, :suspend, :noop]
 | 
			
		||||
 | 
			
		||||
    has_many :accounts, foreign_key: :domain, primary_key: :domain
 | 
			
		||||
  end
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ class RemoveSuspendedSilencedAccountFields < ActiveRecord::Migration[5.2]
 | 
			
		||||
 | 
			
		||||
  class DomainBlock < ApplicationRecord
 | 
			
		||||
    # Dummy class, to make migration possible across version changes
 | 
			
		||||
    enum severity: [:silence, :suspend, :noop]
 | 
			
		||||
    enum :severity, [:silence, :suspend, :noop]
 | 
			
		||||
 | 
			
		||||
    has_many :accounts, foreign_key: :domain, primary_key: :domain
 | 
			
		||||
  end
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ class FillAccountSuspensionOrigin < ActiveRecord::Migration[5.2]
 | 
			
		||||
  class MigrationAccount < ApplicationRecord
 | 
			
		||||
    self.table_name = :accounts
 | 
			
		||||
    scope :suspended, -> { where.not(suspended_at: nil) }
 | 
			
		||||
    enum suspension_origin: { local: 0, remote: 1 }, _prefix: true
 | 
			
		||||
    enum :suspension_origin, { local: 0, remote: 1 }, prefix: true
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def up
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user