Skip to content

Commit

Permalink
fix db helper
Browse files Browse the repository at this point in the history
  • Loading branch information
hooopo committed Dec 13, 2019
1 parent 2cccaca commit abe3ef8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/db_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ class DbHelper
REMAP_SQL ||= <<~SQL
SELECT table_name, column_name
FROM information_schema.columns
WHERE table_schema = 'public'
AND is_updatable = 'YES'
AND (data_type LIKE 'char%' OR data_type LIKE 'text%')
WHERE table_schema = :schema
AND (data_type LIKE '%char%' OR data_type LIKE '%text%')
ORDER BY table_name, column_name
SQL

Expand All @@ -26,7 +25,7 @@ def self.remap(from, to, anchor_left: false, anchor_right: false, excluded_table

text_columns = Hash.new { |h, k| h[k] = [] }

DB.query(REMAP_SQL).each do |r|
DB.query(REMAP_SQL, schema: ActiveRecord::Base.connection.instance_eval{|x| @config[:database]}).each do |r|
unless triggers.include?(Migration::BaseDropper.readonly_trigger_name(r.table_name, r.column_name))
text_columns[r.table_name] << r.column_name
end
Expand Down Expand Up @@ -58,7 +57,7 @@ def self.regexp_replace(pattern, replacement, flags: "gi", match: "~*", excluded

text_columns = Hash.new { |h, k| h[k] = [] }

DB.query(REMAP_SQL).each do |r|
DB.query(REMAP_SQL, schema: ActiveRecord::Base.connection.instance_eval{|x| @config[:database]}).each do |r|
unless triggers.include?(Migration::BaseDropper.readonly_trigger_name(r.table_name, r.column_name))
text_columns[r.table_name] << r.column_name
end
Expand Down

0 comments on commit abe3ef8

Please sign in to comment.