class Tablature::Adapters::Postgres

An adapter for managing Postgres views.

These methods are used internally by Tablature and are not intended for direct use. Methods that alter database schema are intended to be called via {Statements}.

The methods are documented here for insight into specifics of how Tablature integrates with Postgres and the responsibilities of {Adapters}.

Attributes

connectable[R]

Public Class Methods

new(connectable = ActiveRecord::Base) click to toggle source

Creates an instance of the Tablature Postgres adapter.

This is the default adapter for Tablature. Configuring it via {Tablature.configure} is not required, but the example below shows how one would explicitly set it.

@param [#connection] connectable An object that returns the connection

for Tablature to use. Defaults to +ActiveRecord::Base+.

@example

Tablature.configure do |config|
  config.database = Tablature::Adapters::Postgres.new
end
# File lib/tablature/adapters/postgres.rb, line 38
def initialize(connectable = ActiveRecord::Base)
  @connectable = connectable
end

Public Instance Methods

partitioned_tables() click to toggle source

Returns an array of partitioned tables in the database.

This collection of tables is used by the [Tablature::SchemaDumper] to populate the schema.rb file.

@return [Array<Tablature::PartitionedTable]

# File lib/tablature/adapters/postgres.rb, line 124
def partitioned_tables
  PartitionedTables.new(connection).all
end

Private Instance Methods

connection() click to toggle source
# File lib/tablature/adapters/postgres.rb, line 132
def connection
  Connection.new(connectable.connection)
end
list_handler() click to toggle source
# File lib/tablature/adapters/postgres.rb, line 136
def list_handler
  @list_handler ||= Handlers::List.new(connection)
end
range_handler() click to toggle source
# File lib/tablature/adapters/postgres.rb, line 140
def range_handler
  @range_handler ||= Handlers::Range.new(connection)
end