FIX: Remap shouldn't try to change read-only columns

Read-only columns are obsolete and not used in the code anymore.
Previously, remap would fail when trying to update a read-only column.
This commit is contained in:
Neil Lalonde
2019-07-08 16:52:43 -04:00
parent b690fc3d98
commit 9cd3f96dee

View File

@ -17,10 +17,24 @@ WHERE table_schema='public' and (data_type like 'char%' or data_type like 'text%
results = cnn.async_exec(sql).to_a
model_map = {}
results.each do |result|
table_name = result["table_name"]
column_name = result["column_name"]
model = begin
model_map[table_name] ||= table_name.camelize.singularize.constantize
rescue NameError
nil
end
if model &&
model.respond_to?(:ignored_columns) &&
model.ignored_columns.include?(column_name)
next
end
log "Remapping #{table_name} #{column_name}"
result = if @regex