From 67acdac8fc79a9d459ecea4d10e111886509650d Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 7 May 2024 11:03:38 +0200 Subject: [PATCH] Change older Paperclip database migrations for consistency --- .../20160227230233_add_attachment_avatar_to_accounts.rb | 6 +++++- .../20160312193225_add_attachment_header_to_accounts.rb | 6 +++++- db/migrate/20160905150353_create_media_attachments.rb | 8 +++++++- .../20170330164118_add_attachment_data_to_imports.rb | 6 +++++- db/migrate/20170901141119_truncate_preview_cards.rb | 8 +++++++- db/migrate/20170913000752_create_site_uploads.rb | 8 +++++++- db/migrate/20170917153509_create_custom_emojis.rb | 7 ++++++- ...27125810_add_thumbnail_columns_to_media_attachments.rb | 7 ++++++- 8 files changed, 48 insertions(+), 8 deletions(-) diff --git a/db/migrate/20160227230233_add_attachment_avatar_to_accounts.rb b/db/migrate/20160227230233_add_attachment_avatar_to_accounts.rb index 3666abf1cc2..534df25eed1 100644 --- a/db/migrate/20160227230233_add_attachment_avatar_to_accounts.rb +++ b/db/migrate/20160227230233_add_attachment_avatar_to_accounts.rb @@ -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 diff --git a/db/migrate/20160312193225_add_attachment_header_to_accounts.rb b/db/migrate/20160312193225_add_attachment_header_to_accounts.rb index 37108fc1894..b481fc52906 100644 --- a/db/migrate/20160312193225_add_attachment_header_to_accounts.rb +++ b/db/migrate/20160312193225_add_attachment_header_to_accounts.rb @@ -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 diff --git a/db/migrate/20160905150353_create_media_attachments.rb b/db/migrate/20160905150353_create_media_attachments.rb index 3903a7b9a14..92680db9f3d 100644 --- a/db/migrate/20160905150353_create_media_attachments.rb +++ b/db/migrate/20160905150353_create_media_attachments.rb @@ -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 diff --git a/db/migrate/20170330164118_add_attachment_data_to_imports.rb b/db/migrate/20170330164118_add_attachment_data_to_imports.rb index 908d4da96a0..0daaa9d02e7 100644 --- a/db/migrate/20170330164118_add_attachment_data_to_imports.rb +++ b/db/migrate/20170330164118_add_attachment_data_to_imports.rb @@ -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 diff --git a/db/migrate/20170901141119_truncate_preview_cards.rb b/db/migrate/20170901141119_truncate_preview_cards.rb index b4ba8c45ea6..f251841f2e6 100644 --- a/db/migrate/20170901141119_truncate_preview_cards.rb +++ b/db/migrate/20170901141119_truncate_preview_cards.rb @@ -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 diff --git a/db/migrate/20170913000752_create_site_uploads.rb b/db/migrate/20170913000752_create_site_uploads.rb index 43a793806f3..16a95ea0134 100644 --- a/db/migrate/20170913000752_create_site_uploads.rb +++ b/db/migrate/20170913000752_create_site_uploads.rb @@ -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 diff --git a/db/migrate/20170917153509_create_custom_emojis.rb b/db/migrate/20170917153509_create_custom_emojis.rb index 984fcd2181b..dedc8cde80b 100644 --- a/db/migrate/20170917153509_create_custom_emojis.rb +++ b/db/migrate/20170917153509_create_custom_emojis.rb @@ -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 diff --git a/db/migrate/20200627125810_add_thumbnail_columns_to_media_attachments.rb b/db/migrate/20200627125810_add_thumbnail_columns_to_media_attachments.rb index a3c6b55fd22..c11a24e8b53 100644 --- a/db/migrate/20200627125810_add_thumbnail_columns_to_media_attachments.rb +++ b/db/migrate/20200627125810_add_thumbnail_columns_to_media_attachments.rb @@ -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