Sha256: 699be58bb5c6c8d69a5dac6db6b737e6f6e2f746e2fdf072d7a2809ae02d9c64

Contents?: true

Size: 547 Bytes

Versions: 6

Compression:

Stored size: 547 Bytes

Contents

# frozen_string_literal: true

module TableSaw
  module Queries
    class NoIdTables
      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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
table_saw-0.5.0 lib/table_saw/queries/no_id_tables.rb
table_saw-0.4.0 lib/table_saw/queries/no_id_tables.rb
table_saw-0.3.0 lib/table_saw/queries/no_id_tables.rb
table_saw-0.2.1 lib/table_saw/queries/no_id_tables.rb
table_saw-0.2.0 lib/table_saw/queries/no_id_tables.rb
table_saw-0.1.0 lib/table_saw/queries/no_id_tables.rb