Module: SchemaPlus::ActiveRecord::ConnectionAdapters::PostgreSQLColumn

Defined in:
lib/schema_plus/active_record/connection_adapters/postgresql_adapter.rb

Overview

PostgreSQL-specific extensions to column definitions in a table.

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Extracts the value from a PostgreSQL column default definition.



7
8
9
10
11
12
13
14
# File 'lib/schema_plus/active_record/connection_adapters/postgresql_adapter.rb', line 7

def self.included(base) #:nodoc:
  base.extend ClassMethods
  base.class_eval do
    class << self
      alias_method_chain :extract_value_from_default, :schema_plus
    end
  end
end

Instance Method Details

#initialize(name, default, sql_type = nil, null = true) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/schema_plus/active_record/connection_adapters/postgresql_adapter.rb', line 16

def initialize(name, default, sql_type = nil, null = true)
  if default.is_a? Hash
    if default[:expr]
      @default_expr = default[:expr]
    end
    default = nil
  end
  super(name, default, sql_type, null)
end