mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
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
1 changed files with 9 additions and 5 deletions
|
@ -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}"
|
||||
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 a new issue