From 97db4fe4f9bbf99c90984a38812864e92258e314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Fri, 29 May 2020 14:53:05 +0300 Subject: [PATCH] Migrations from rails app:update --- ...e_storage_attachments_for_blob_id.active_storage.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 db/migrate/20200529115011_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb diff --git a/db/migrate/20200529115011_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb b/db/migrate/20200529115011_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb new file mode 100644 index 000000000..ff5d72c7e --- /dev/null +++ b/db/migrate/20200529115011_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb @@ -0,0 +1,10 @@ +# This migration comes from active_storage (originally 20180723000244) +class AddForeignKeyConstraintToActiveStorageAttachmentsForBlobId < ActiveRecord::Migration[6.0] + def up + 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 +end