From 92fdbe8878c1b3a34b438f0f1f11bd89498f0518 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sun, 30 Aug 2015 01:35:48 +0200 Subject: [PATCH] Improved error handling. --- db/migrate/20150824000002_update_channel.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/db/migrate/20150824000002_update_channel.rb b/db/migrate/20150824000002_update_channel.rb index 4d3fa0bbe..cf2686b07 100644 --- a/db/migrate/20150824000002_update_channel.rb +++ b/db/migrate/20150824000002_update_channel.rb @@ -5,10 +5,12 @@ class UpdateChannel < ActiveRecord::Migration EmailAddress.reset_column_information channel_inbound = Channel.find_by(area: 'Email::Inbound') - EmailAddress.all.each {|email_address| - email_address.channel_id = channel_inbound.id - email_address.save - } + if channel_inbound + EmailAddress.all.each {|email_address| + email_address.channel_id = channel_inbound.id + email_address.save + } + end add_column :channels, :last_log_in, :text, limit: 500.kilobytes + 1, null: true add_column :channels, :last_log_out, :text, limit: 500.kilobytes + 1, null: true