Change older Paperclip database migrations for consistency (#30204)
This commit is contained in:
		@@ -3,7 +3,11 @@
 | 
			
		||||
class AddAttachmentAvatarToAccounts < ActiveRecord::Migration[4.2]
 | 
			
		||||
  def self.up
 | 
			
		||||
    change_table :accounts do |t|
 | 
			
		||||
      t.attachment :avatar
 | 
			
		||||
      # The following corresponds to `t.attachment :avatar` in an older version of Paperclip
 | 
			
		||||
      t.string :avatar_file_name
 | 
			
		||||
      t.string :avatar_content_type
 | 
			
		||||
      t.integer :avatar_file_size
 | 
			
		||||
      t.datetime :avatar_updated_at
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,11 @@
 | 
			
		||||
class AddAttachmentHeaderToAccounts < ActiveRecord::Migration[4.2]
 | 
			
		||||
  def self.up
 | 
			
		||||
    change_table :accounts do |t|
 | 
			
		||||
      t.attachment :header
 | 
			
		||||
      # The following corresponds to `t.attachment :header` in an older version of Paperclip
 | 
			
		||||
      t.string :header_file_name
 | 
			
		||||
      t.string :header_content_type
 | 
			
		||||
      t.integer :header_file_size
 | 
			
		||||
      t.datetime :header_updated_at
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,13 @@ class CreateMediaAttachments < ActiveRecord::Migration[5.0]
 | 
			
		||||
  def change
 | 
			
		||||
    create_table :media_attachments do |t|
 | 
			
		||||
      t.integer :status_id, null: true, default: nil
 | 
			
		||||
      t.attachment :file
 | 
			
		||||
 | 
			
		||||
      # The following corresponds to `t.attachment :file` in an older version of Paperclip
 | 
			
		||||
      t.string :file_file_name
 | 
			
		||||
      t.string :file_content_type
 | 
			
		||||
      t.integer :file_file_size
 | 
			
		||||
      t.datetime :file_updated_at
 | 
			
		||||
 | 
			
		||||
      t.string :remote_url, null: false, default: ''
 | 
			
		||||
      t.integer :account_id
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,11 @@
 | 
			
		||||
class AddAttachmentDataToImports < ActiveRecord::Migration[4.2]
 | 
			
		||||
  def self.up
 | 
			
		||||
    change_table :imports do |t|
 | 
			
		||||
      t.attachment :data
 | 
			
		||||
      # The following corresponds to `t.attachment :data` in an older version of Paperclip
 | 
			
		||||
      t.string :data_file_name
 | 
			
		||||
      t.string :data_content_type
 | 
			
		||||
      t.integer :data_file_size
 | 
			
		||||
      t.datetime :data_updated_at
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,13 @@ class TruncatePreviewCards < ActiveRecord::Migration[5.1]
 | 
			
		||||
      t.string     :url, default: '', null: false, index: { unique: true }
 | 
			
		||||
      t.string     :title, default: '', null: false
 | 
			
		||||
      t.string     :description, default: '', null: false
 | 
			
		||||
      t.attachment :image
 | 
			
		||||
 | 
			
		||||
      # The following corresponds to `t.attachment :image` in an older version of Paperclip
 | 
			
		||||
      t.string :image_file_name
 | 
			
		||||
      t.string :image_content_type
 | 
			
		||||
      t.integer :image_file_size
 | 
			
		||||
      t.datetime :image_updated_at
 | 
			
		||||
 | 
			
		||||
      t.integer    :type, default: 0, null: false
 | 
			
		||||
      t.text       :html, default: '', null: false
 | 
			
		||||
      t.string     :author_name, default: '', null: false
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,13 @@ class CreateSiteUploads < ActiveRecord::Migration[5.1]
 | 
			
		||||
  def change
 | 
			
		||||
    create_table :site_uploads do |t|
 | 
			
		||||
      t.string :var, default: '', null: false, index: { unique: true }
 | 
			
		||||
      t.attachment :file
 | 
			
		||||
 | 
			
		||||
      # The following corresponds to `t.attachment :file` in an older version of Paperclip
 | 
			
		||||
      t.string :file_file_name
 | 
			
		||||
      t.string :file_content_type
 | 
			
		||||
      t.integer :file_file_size
 | 
			
		||||
      t.datetime :file_updated_at
 | 
			
		||||
 | 
			
		||||
      t.json :meta
 | 
			
		||||
      t.timestamps
 | 
			
		||||
    end
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,12 @@ class CreateCustomEmojis < ActiveRecord::Migration[5.1]
 | 
			
		||||
    create_table :custom_emojis do |t|
 | 
			
		||||
      t.string :shortcode, null: false, default: ''
 | 
			
		||||
      t.string :domain
 | 
			
		||||
      t.attachment :image
 | 
			
		||||
 | 
			
		||||
      # The following corresponds to `t.attachment :image` in an older version of Paperclip
 | 
			
		||||
      t.string :image_file_name
 | 
			
		||||
      t.string :image_content_type
 | 
			
		||||
      t.integer :image_file_size
 | 
			
		||||
      t.datetime :image_updated_at
 | 
			
		||||
 | 
			
		||||
      t.timestamps
 | 
			
		||||
    end
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,12 @@
 | 
			
		||||
 | 
			
		||||
class AddThumbnailColumnsToMediaAttachments < ActiveRecord::Migration[5.2]
 | 
			
		||||
  def up
 | 
			
		||||
    add_attachment :media_attachments, :thumbnail
 | 
			
		||||
    # The following corresponds to `add_attachment :media_attachments, :thumbnail` in an older version of Paperclip
 | 
			
		||||
    add_column :media_attachments, :thumbnail_file_name, :string
 | 
			
		||||
    add_column :media_attachments, :thumbnail_content_type, :string
 | 
			
		||||
    add_column :media_attachments, :thumbnail_file_size, :integer
 | 
			
		||||
    add_column :media_attachments, :thumbnail_updated_at, :datetime
 | 
			
		||||
 | 
			
		||||
    add_column :media_attachments, :thumbnail_remote_url, :string
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user