aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2019-03-19 09:19:36 -0400
committerGitHub <noreply@github.com>2019-03-19 09:19:36 -0400
commit969a1416ebbb74ffb50617ae00029308e8d4f176 (patch)
tree2fd6761343072689856208754759050df69fdda7
parentd17340c00299c400a75e0a40e2dd21e9fb3a9630 (diff)
parent135d8a0dc100f10ffa57fb4ed877fc1cc29c7608 (diff)
downloadrails-969a1416ebbb74ffb50617ae00029308e8d4f176.tar.gz
rails-969a1416ebbb74ffb50617ae00029308e8d4f176.tar.bz2
rails-969a1416ebbb74ffb50617ae00029308e8d4f176.zip
Merge pull request #35620 from RTJ/master
Fix for migration active_storage migration
-rw-r--r--activestorage/db/update_migrate/20180723000244_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/activestorage/db/update_migrate/20180723000244_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.rb b/activestorage/db/update_migrate/20180723000244_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.rb
index 6830203cd6..5472e3c87b 100644
--- a/activestorage/db/update_migrate/20180723000244_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.rb
+++ b/activestorage/db/update_migrate/20180723000244_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.rb
@@ -1,6 +1,8 @@
class AddForeignKeyConstraintToActiveStorageAttachmentsForBlobId < ActiveRecord::Migration[6.0]
def up
- unless foreign_key_exists?(:active_storage_attachments, column: :blob_id)
+ return if foreign_key_exists?(:active_storage_attachments, column: :blob_id)
+
+ if table_exists?(:active_storage_blobs)
add_foreign_key :active_storage_attachments, :active_storage_blobs, column: :blob_id
end
end