From 64306cfb2a9dee6f5d1a9964ff283bc1e8acfd54 Mon Sep 17 00:00:00 2001 From: aignatov-bio <47317017+aignatov-bio@users.noreply.github.com> Date: Wed, 18 Sep 2019 09:20:04 +0200 Subject: [PATCH] Fix active storage migration script (#2060) * Fix active storage migration script * Update check logic --- db/migrate/20190613134100_convert_to_active_storage.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db/migrate/20190613134100_convert_to_active_storage.rb b/db/migrate/20190613134100_convert_to_active_storage.rb index 5d7af21fa..426ebc7a6 100644 --- a/db/migrate/20190613134100_convert_to_active_storage.rb +++ b/db/migrate/20190613134100_convert_to_active_storage.rb @@ -25,6 +25,8 @@ class ConvertToActiveStorage < ActiveRecord::Migration[5.2] transaction do models.each do |model| + next unless ActiveRecord::Base.connection.table_exists?(model.table_name) + attachments = model.column_names.map do |c| $1 if c =~ /(.+)_file_name$/ end.compact