diff --git a/script/discourse b/script/discourse index 551c787dc..4fdc7a6a8 100755 --- a/script/discourse +++ b/script/discourse @@ -29,11 +29,15 @@ WHERE table_schema='public' and (data_type like 'char%' or data_type like 'text% table_name = result["table_name"] column_name = result["column_name"] puts "Remapping #{table_name} #{column_name}" - result = cnn.async_exec("UPDATE #{table_name} - SET #{column_name} = replace(#{column_name}, $1, $2) - WHERE NOT #{column_name} IS NULL - AND #{column_name} <> replace(#{column_name}, $1, $2)", [from, to]) - puts "#{result.cmd_tuples} rows affected!" + begin + result = cnn.async_exec("UPDATE #{table_name} + SET #{column_name} = replace(#{column_name}, $1, $2) + WHERE NOT #{column_name} IS NULL + AND #{column_name} <> replace(#{column_name}, $1, $2)", [from, to]) + puts "#{result.cmd_tuples} rows affected!" + rescue => ex + puts "Error: #{ex}" + end end end