FIX: Don't break out of remap action if there is a DB error. Display it
and continue.
This commit is contained in:
parent
9964955e88
commit
f2cca140b4
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue