1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Make foreign_keys queries to SCHEMA

This commit is contained in:
Ryuta Kamizono 2016-06-07 06:16:56 +09:00
parent 3da81f89ab
commit 16bb3d6f12
2 changed files with 2 additions and 2 deletions

View file

@ -515,7 +515,7 @@ module ActiveRecord
schema, name = extract_schema_qualified_name(table_name)
fk_info = select_all <<-SQL.strip_heredoc
fk_info = select_all(<<-SQL.strip_heredoc, 'SCHEMA')
SELECT fk.referenced_table_name as 'to_table'
,fk.referenced_column_name as 'primary_key'
,fk.column_name as 'column'

View file

@ -579,7 +579,7 @@ module ActiveRecord
end
def foreign_keys(table_name)
fk_info = select_all <<-SQL.strip_heredoc
fk_info = select_all(<<-SQL.strip_heredoc, 'SCHEMA')
SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid