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
Public Class Methods
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
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
# File lib/tablature/adapters/postgres.rb, line 132 def connection Connection.new(connectable.connection) end
# File lib/tablature/adapters/postgres.rb, line 136 def list_handler @list_handler ||= Handlers::List.new(connection) end
# File lib/tablature/adapters/postgres.rb, line 140 def range_handler @range_handler ||= Handlers::Range.new(connection) end