Fix migrations [SCI-3988]

This commit is contained in:
Oleksii Kriuchykhin 2020-01-07 13:43:32 +01:00
parent 5e8afae1f0
commit 3e82b1ae89
10 changed files with 9 additions and 42 deletions

View file

@ -1,9 +0,0 @@
class AddUserColumns < ActiveRecord::Migration[4.2]
def up
add_attachment :users, :avatar
end
def down
remove_attachment :users, :avatar
end
end

View file

@ -4,7 +4,6 @@ class CreateAssets < ActiveRecord::Migration[4.2]
t.timestamps null: false
end
add_attachment :assets, :file
add_index :assets, :created_at
end
end

View file

@ -5,6 +5,5 @@ class CreateTempFiles < ActiveRecord::Migration[4.2]
t.timestamps null: false
end
add_attachment :temp_files, :file
end
end

View file

@ -19,7 +19,6 @@ 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
@ -42,7 +41,6 @@ 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

View file

@ -1,9 +0,0 @@
class AddAttachmentWorkflowimgToExperiments < ActiveRecord::Migration[4.2]
def self.up
add_attachment :experiments, :workflowimg
end
def self.down
remove_attachment :experiments, :workflowimg
end
end

View file

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

View file

@ -44,9 +44,6 @@ 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
@ -115,7 +112,6 @@ 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
@ -151,7 +147,6 @@ 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

View file

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

View file

@ -6,33 +6,33 @@ class RemovePaperclipColumns < ActiveRecord::Migration[6.0]
:file_file_name,
:file_content_type,
:file_file_size,
:file_updated_at,
:file_present
:file_updated_at if column_exists? :assets, :file_file_name
remove_columns :assets, :file_present
remove_columns :experiments,
:workflowimg_file_name,
:workflowimg_content_type,
:workflowimg_file_size,
:workflowimg_updated_at
:workflowimg_updated_at if column_exists? :experiments, :workflowimg_file_name
remove_columns :temp_files,
:file_file_name,
:file_content_type,
:file_file_size,
:file_updated_at
:file_updated_at if column_exists? :temp_files, :file_file_name
remove_columns :tiny_mce_assets,
:image_file_name,
:image_content_type,
:image_file_size,
:image_updated_at
:image_updated_at if column_exists? :tiny_mce_assets, :image_file_name
remove_columns :users,
:avatar_file_name,
:avatar_content_type,
:avatar_file_size,
:avatar_updated_at
:avatar_updated_at if column_exists? :users, :avatar_file_name
remove_columns :zip_exports,
:zip_file_file_name,
:zip_file_content_type,
:zip_file_file_size,
:zip_file_updated_at
:zip_file_updated_at if column_exists? :zip_exports, :zip_file_file_name
end
def down

View file

@ -168,8 +168,8 @@ ALTER SEQUENCE public.activities_id_seq OWNED BY public.activities.id;
CREATE TABLE public.ar_internal_metadata (
key character varying NOT NULL,
value character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
@ -6336,7 +6336,6 @@ SET search_path TO "$user", public;
INSERT INTO "schema_migrations" (version) VALUES
('20150713060702'),
('20150713061603'),
('20150713063224'),
('20150713070738'),
('20150713071921'),
@ -6420,7 +6419,6 @@ INSERT INTO "schema_migrations" (version) VALUES
('20160704110900'),
('20160722082700'),
('20160803082801'),
('20160808083040'),
('20160809074757'),
('20160928114119'),
('20160928114915'),
@ -6489,7 +6487,6 @@ INSERT INTO "schema_migrations" (version) VALUES
('20190830141257'),
('20190910125740'),
('20191001133557'),
('20191009146101'),
('20191023162335');