Class: ActiveRecord::ConnectionAdapters::IBM_DBAdapter::TableDefinition

Inherits:
TableDefinition
  • Object
show all
Includes:
ColumnMethods
Defined in:
lib/active_record/connection_adapters/ibm_db_adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ColumnMethods

#primary_key

Constructor Details

#initializeTableDefinition

Returns a new instance of TableDefinition.



870
871
872
873
874
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 870

def initialize(*, **)
  super
  @exclusion_constraints = []
  @unique_constraints = []
end

Instance Attribute Details

#exclusion_constraintsObject (readonly)

Returns the value of attribute exclusion_constraints.



868
869
870
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 868

def exclusion_constraints
  @exclusion_constraints
end

#unique_constraintsObject (readonly)

Returns the value of attribute unique_constraints.



868
869
870
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 868

def unique_constraints
  @unique_constraints
end

Instance Method Details

#exclusion_constraint(expression, **options) ⇒ Object



876
877
878
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 876

def exclusion_constraint(expression, **options)
  exclusion_constraints << new_exclusion_constraint_definition(expression, options)
end

#new_unique_constraint_definition(column_name, options) ⇒ Object

:nodoc:



886
887
888
889
890
891
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 886

def new_unique_constraint_definition(column_name, options) # :nodoc:
  @conn.puts_log "TD new_unique_constraint_definition column_name = #{column_name}, options = #{options}"
  @conn.puts_log caller
  options = @conn.unique_constraint_options(name, column_name, options)
  UniqueConstraintDefinition.new(name, column_name, options)
end

#unique_constraint(column_name, **options) ⇒ Object



880
881
882
883
884
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 880

def unique_constraint(column_name, **options)
  @conn.puts_log "TD unique_constraint column_name = #{column_name}, options = #{options}"
  unique_constraints << new_unique_constraint_definition(column_name, options)
  @conn.puts_log "unique_constraints = #{unique_constraints}"
end