in db/migrate/20191204104402_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb [2:9]
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