Module: Tablature

Defined in:
lib/tablature.rb,
lib/tablature/model.rb,
lib/tablature/railtie.rb,
lib/tablature/version.rb,
lib/tablature/statements.rb,
lib/tablature/configuration.rb,
lib/tablature/schema_dumper.rb,
lib/tablature/command_recorder.rb,
lib/tablature/adapters/postgres.rb,
lib/tablature/partitioned_table.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

Tablature adds methods to ‘ActiveRecord::Migration` to create and manage partitioned tables in Rails applications.

Defined Under Namespace

Modules: Adapters, CommandRecorder, Model, SchemaDumper, Statements Classes: Configuration, MissingPartition, PartitionedTable, Railtie

Constant Summary collapse

VERSION =
'0.3.1'.freeze

Class Method Summary collapse

Class Method Details

.configurationTablature::Configuration

Returns Tablature’s current configuration.

Returns:



15
16
17
# File 'lib/tablature/configuration.rb', line 15

def self.configuration
  @configuration ||= Configuration.new
end

.configuration=(config) ⇒ Object

Set Tablature’s configuration

Parameters:



22
23
24
# File 'lib/tablature/configuration.rb', line 22

def self.configuration=(config)
  @configuration = config
end

.configure {|config| ... } ⇒ Object

Modify Tablature’s current configuration

Examples:

Tablature.configure do |config|
  config.database = Tablature::Adapters::Postgres.new
end

Yield Parameters:



33
34
35
# File 'lib/tablature/configuration.rb', line 33

def self.configure
  yield configuration
end

.databaseObject

The current database adapter used by Tablature.

This defaults to Tablature::Adapters::Postgres by can be overriden via Configuration.



29
30
31
# File 'lib/tablature.rb', line 29

def self.database
  configuration.database
end

.loadObject

Hooks Tablature into Rails.

Enables tablature migration methods.



19
20
21
22
23
24
# File 'lib/tablature.rb', line 19

def self.load
  ActiveRecord::ConnectionAdapters::AbstractAdapter.include Tablature::Statements
  ActiveRecord::Migration::CommandRecorder.include Tablature::CommandRecorder
  ActiveRecord::SchemaDumper.prepend Tablature::SchemaDumper
  ActiveRecord::Base.include Tablature::Model
end