Module: PgPower::ConnectionAdapters::AbstractAdapter::SchemaMethods

Included in:
PgPower::ConnectionAdapters::AbstractAdapter
Defined in:
lib/pg_power/connection_adapters/abstract_adapter/schema_methods.rb

Overview

Extends ActiveRecord::ConnectionAdapters::AbstractAdapter with methods for multi-schema support.

Instance Method Summary collapse

Instance Method Details

#create_table_with_schema_option(table_name, options = {}, &block) ⇒ Object

Provide :schema option to create_table method.



6
7
8
9
10
11
# File 'lib/pg_power/connection_adapters/abstract_adapter/schema_methods.rb', line 6

def create_table_with_schema_option(table_name, options = {}, &block)
  options     = options.dup
  schema_name = options.delete(:schema)
  table_name  = "#{schema_name}.#{table_name}" if schema_name
  create_table_without_schema_option(table_name, options, &block)
end

#drop_table_with_schema_option(table_name, options = {}) ⇒ Object

Provide :schema option to drop_table method.



14
15
16
17
18
19
# File 'lib/pg_power/connection_adapters/abstract_adapter/schema_methods.rb', line 14

def drop_table_with_schema_option(table_name, options = {})
  options     = options.dup
  schema_name = options.delete(:schema)
  table_name  = "#{schema_name}.#{table_name}" if schema_name
  drop_table_without_schema_option(table_name, options)
end