Method: Simple::SQL::Connection::Reflection#table_info

Defined in:
lib/simple/sql/connection/reflection.rb

#table_info(schema: "public") ⇒ Object



82
83
84
85
86
87
88
89
# File 'lib/simple/sql/connection/reflection.rb', line 82

def table_info(schema: "public")
  recs = @connection.all <<~SQL, schema, into: Hash
    SELECT table_schema || '.' || table_name AS name, *
    FROM information_schema.tables
    WHERE table_schema=$1
  SQL
  records_by_attr(recs, :name)
end