Class: TableSaw::Queries::NoIdTables

Inherits:
Object
  • Object
show all
Defined in:
lib/table_saw/queries/no_id_tables.rb

Constant Summary collapse

QUERY =
<<~SQL
  select t.table_name
  from information_schema.tables t left outer join information_schema.table_constraints tc
      on t.table_name = tc.table_name and tc.constraint_type = 'PRIMARY KEY'
  where t.table_schema = 'public' and table_type = 'BASE TABLE' and tc.table_name IS NULL
SQL

Instance Method Summary collapse

Instance Method Details

#callObject



13
14
15
16
17
# File 'lib/table_saw/queries/no_id_tables.rb', line 13

def call
  TableSaw::Connection.with do |conn|
    conn.exec(QUERY)
  end
end