Class: Tablature::Adapters::Postgres
- Inherits:
-
Object
- Object
- Tablature::Adapters::Postgres
- Defined in:
- lib/tablature/adapters/postgres.rb,
lib/tablature/adapters/postgres/uuid.rb,
lib/tablature/adapters/postgres/errors.rb,
lib/tablature/adapters/postgres/quoting.rb,
lib/tablature/adapters/postgres/connection.rb,
lib/tablature/adapters/postgres/handlers/base.rb,
lib/tablature/adapters/postgres/handlers/list.rb,
lib/tablature/adapters/postgres/handlers/range.rb,
lib/tablature/adapters/postgres/partitioned_tables.rb
Overview
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 Tablature::Adapters.
Defined Under Namespace
Modules: Handlers, Quoting, UUID Classes: Connection, ListPartitionsNotSupportedError, MissingListPartitionValuesError, MissingRangePartitionBoundsError, PartitionedTables, RangePartitionsNotSupportedError
Instance Method Summary collapse
-
#create_list_partition(table_name, options) {|td| ... } ⇒ Object
Creates a partitioned table using the list partition method.
-
#create_list_partition_of(parent_table_name, options) ⇒ Object
Creates a partition of a parent by specifying the key values appearing in the partition.
-
#create_range_partition(table_name, options) {|td| ... } ⇒ Object
Creates a partitioned table using the range partition method.
-
#create_range_partition_of(parent_table_name, options) ⇒ Object
Creates a partition of a parent by specifying the bound of the values appearing in the partition.
-
#initialize(connectable = ActiveRecord::Base) ⇒ Postgres
constructor
Creates an instance of the Tablature Postgres adapter.
-
#partitioned_tables ⇒ Array<Tablature::PartitionedTable]
Returns an array of partitioned tables in the database.
Constructor Details
#initialize(connectable = ActiveRecord::Base) ⇒ Postgres
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.
38 39 40 |
# File 'lib/tablature/adapters/postgres.rb', line 38 def initialize(connectable = ActiveRecord::Base) @connectable = connectable end |
Instance Method Details
#create_list_partition(table_name, options) {|td| ... } ⇒ Object
Creates a partitioned table using the list partition method.
This is called in a migration via Statements#create_list_partition.
61 |
# File 'lib/tablature/adapters/postgres.rb', line 61 delegate :create_list_partition, to: :list_handler |
#create_list_partition_of(parent_table_name, options) ⇒ Object
Creates a partition of a parent by specifying the key values appearing in the partition.
77 |
# File 'lib/tablature/adapters/postgres.rb', line 77 delegate :create_list_partition_of, to: :list_handler |
#create_range_partition(table_name, options) {|td| ... } ⇒ Object
Creates a partitioned table using the range partition method.
This is called in a migration via Statements#create_range_partition.
97 |
# File 'lib/tablature/adapters/postgres.rb', line 97 delegate :create_range_partition, to: :range_handler |
#create_range_partition_of(parent_table_name, options) ⇒ Object
Creates a partition of a parent by specifying the bound of the values appearing in the
partition.
116 |
# File 'lib/tablature/adapters/postgres.rb', line 116 delegate :create_range_partition_of, to: :range_handler |
#partitioned_tables ⇒ Array<Tablature::PartitionedTable]
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.
124 125 126 |
# File 'lib/tablature/adapters/postgres.rb', line 124 def partitioned_tables PartitionedTables.new(connection).all end |