From ab395f46d0549499c2357adfb752fe49a88e43d4 Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Wed, 9 Oct 2019 10:28:02 +0200 Subject: [PATCH] Add paperclip for backward compatibility [SCI-3949] --- Gemfile | 1 + Gemfile.lock | 10 ++++++++++ db/migrate/20150713061603_add_user_columns.rb | 9 +++++++++ db/migrate/20150715141810_create_assets.rb | 1 + db/migrate/20150923065605_create_temp_files.rb | 1 + db/migrate/20151021085335_add_search_query_indexes.rb | 2 ++ ...083040_add_attachment_workflowimg_to_experiments.rb | 9 +++++++++ db/migrate/20170321131116_create_zip_exports.rb | 2 ++ .../20170407082423_update_indexes_for_faster_search.rb | 5 +++++ ...20075905_add_attachment_image_to_tiny_mce_assets.rb | 1 + 10 files changed, 41 insertions(+) create mode 100644 db/migrate/20150713061603_add_user_columns.rb create mode 100644 db/migrate/20160808083040_add_attachment_workflowimg_to_experiments.rb diff --git a/Gemfile b/Gemfile index 0aa585d97..fa443c790 100644 --- a/Gemfile +++ b/Gemfile @@ -90,6 +90,7 @@ gem 'devise-async', git: 'https://github.com/mhfs/devise-async.git', branch: 'devise-4.x' gem 'image_processing', '~> 1.2' +gem 'paperclip', '~> 6.1' gem 'rufus-scheduler', '~> 3.5' gem 'discard', '~> 1.0' diff --git a/Gemfile.lock b/Gemfile.lock index db6f2c48d..c512d0bdf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -177,6 +177,7 @@ GEM activesupport childprocess (1.0.1) rake (< 13.0) + climate_control (0.2.0) coderay (1.1.2) coffee-rails (5.0.0) coffee-script (>= 2.2.0) @@ -373,6 +374,12 @@ GEM overcommit (0.49.1) childprocess (>= 0.6.3, < 2.0) iniparse (~> 1.4) + paperclip (6.1.0) + activemodel (>= 4.2.0) + activesupport (>= 4.2.0) + mime-types + mimemagic (~> 0.3.0) + terrapin (~> 0.6.0) parallel (1.17.0) parser (2.6.4.0) ast (~> 2.4.0) @@ -540,6 +547,8 @@ GEM activesupport (>= 4.0) sprockets (>= 3.0.0) stream (0.5.2) + terrapin (0.6.0) + climate_control (>= 0.0.3, < 1.0) thor (0.20.3) thread_safe (0.3.6) tilt (2.0.9) @@ -643,6 +652,7 @@ DEPENDENCIES omniauth-linkedin-oauth2 omniauth-rails_csrf_protection (~> 0.1) overcommit + paperclip (~> 6.1) pg (~> 1.1) pg_search pry diff --git a/db/migrate/20150713061603_add_user_columns.rb b/db/migrate/20150713061603_add_user_columns.rb new file mode 100644 index 000000000..0d37c1a2d --- /dev/null +++ b/db/migrate/20150713061603_add_user_columns.rb @@ -0,0 +1,9 @@ +class AddUserColumns < ActiveRecord::Migration[4.2] + def up + add_attachment :users, :avatar + end + + def down + remove_attachment :users, :avatar + end +end diff --git a/db/migrate/20150715141810_create_assets.rb b/db/migrate/20150715141810_create_assets.rb index adcf748bb..f51df23de 100644 --- a/db/migrate/20150715141810_create_assets.rb +++ b/db/migrate/20150715141810_create_assets.rb @@ -4,6 +4,7 @@ class CreateAssets < ActiveRecord::Migration[4.2] t.timestamps null: false end + add_attachment :assets, :file add_index :assets, :created_at end end diff --git a/db/migrate/20150923065605_create_temp_files.rb b/db/migrate/20150923065605_create_temp_files.rb index 5c93d94d6..e992266ed 100644 --- a/db/migrate/20150923065605_create_temp_files.rb +++ b/db/migrate/20150923065605_create_temp_files.rb @@ -5,5 +5,6 @@ class CreateTempFiles < ActiveRecord::Migration[4.2] t.timestamps null: false end + add_attachment :temp_files, :file end end diff --git a/db/migrate/20151021085335_add_search_query_indexes.rb b/db/migrate/20151021085335_add_search_query_indexes.rb index 3a8b0f2fd..c8b67aa35 100644 --- a/db/migrate/20151021085335_add_search_query_indexes.rb +++ b/db/migrate/20151021085335_add_search_query_indexes.rb @@ -19,6 +19,7 @@ class AddSearchQueryIndexes < ActiveRecord::Migration[4.2] add_gist_index :tags, :name add_gist_index :steps, :name add_gist_index :results, :name + add_gist_index :assets, :file_file_name # There's already semi-useless BTree index on samples remove_index :samples, :name @@ -41,6 +42,7 @@ class AddSearchQueryIndexes < ActiveRecord::Migration[4.2] remove_index :tags, :name remove_index :steps, :name remove_index :results, :name + remove_index :assets, :file_file_name # Re-add semi-useless BTree index on samples remove_index :samples, :name diff --git a/db/migrate/20160808083040_add_attachment_workflowimg_to_experiments.rb b/db/migrate/20160808083040_add_attachment_workflowimg_to_experiments.rb new file mode 100644 index 000000000..5095d1542 --- /dev/null +++ b/db/migrate/20160808083040_add_attachment_workflowimg_to_experiments.rb @@ -0,0 +1,9 @@ +class AddAttachmentWorkflowimgToExperiments < ActiveRecord::Migration[4.2] + def self.up + add_attachment :experiments, :workflowimg + end + + def self.down + remove_attachment :experiments, :workflowimg + end +end diff --git a/db/migrate/20170321131116_create_zip_exports.rb b/db/migrate/20170321131116_create_zip_exports.rb index 44945e162..19e0cf688 100644 --- a/db/migrate/20170321131116_create_zip_exports.rb +++ b/db/migrate/20170321131116_create_zip_exports.rb @@ -4,5 +4,7 @@ class CreateZipExports < ActiveRecord::Migration[4.2] t.references :user, index: true, foreign_key: true t.timestamps null: false end + + add_attachment :zip_exports, :zip_file end end diff --git a/db/migrate/20170407082423_update_indexes_for_faster_search.rb b/db/migrate/20170407082423_update_indexes_for_faster_search.rb index f2bd0c7ff..403c466d5 100644 --- a/db/migrate/20170407082423_update_indexes_for_faster_search.rb +++ b/db/migrate/20170407082423_update_indexes_for_faster_search.rb @@ -44,6 +44,9 @@ class UpdateIndexesForFasterSearch < ActiveRecord::Migration[4.2] if index_name_exists? :reports, :index_reports_on_description remove_index :reports, name: :index_reports_on_description end + if index_name_exists?(:assets, :index_assets_on_file_file_name) + remove_index :assets, name: :index_assets_on_file_file_name + end if index_name_exists? :samples, :index_samples_on_name remove_index :samples, name: :index_samples_on_name end @@ -112,6 +115,7 @@ class UpdateIndexesForFasterSearch < ActiveRecord::Migration[4.2] add_gin_index_without_tags :result_texts, :text add_gin_index_without_tags :reports, :name add_gin_index_without_tags :reports, :description + add_gin_index_without_tags :assets, :file_file_name add_gin_index_without_tags :samples, :name add_gin_index_without_tags :sample_types, :name add_gin_index_without_tags :sample_groups, :name @@ -147,6 +151,7 @@ class UpdateIndexesForFasterSearch < ActiveRecord::Migration[4.2] remove_index :result_texts, :text remove_index :reports, :name remove_index :reports, :description + remove_index :assets, :file_file_name remove_index :samples, :name remove_index :sample_types, :name remove_index :sample_groups, :name diff --git a/db/migrate/20170420075905_add_attachment_image_to_tiny_mce_assets.rb b/db/migrate/20170420075905_add_attachment_image_to_tiny_mce_assets.rb index d02dfd3b5..0e38a78ee 100644 --- a/db/migrate/20170420075905_add_attachment_image_to_tiny_mce_assets.rb +++ b/db/migrate/20170420075905_add_attachment_image_to_tiny_mce_assets.rb @@ -1,6 +1,7 @@ class AddAttachmentImageToTinyMceAssets < ActiveRecord::Migration[4.2] def change create_table :tiny_mce_assets do |t| + t.attachment :image t.integer :estimated_size, default: 0, null: false t.references :step, index: true t.references :team, index: true