Class: ActiveRecord::ConnectionAdapters::AlterTable

Inherits:
Object
  • Object
show all
Defined in:
activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(td) ⇒ AlterTable

Returns a new instance of AlterTable.


400
401
402
403
404
405
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 400

def initialize(td)
  @td   = td
  @adds = []
  @foreign_key_adds = []
  @foreign_key_drops = []
end

Instance Attribute Details

#addsObject (readonly)

Returns the value of attribute adds


396
397
398
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 396

def adds
  @adds
end

#foreign_key_addsObject (readonly)

Returns the value of attribute foreign_key_adds


397
398
399
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 397

def foreign_key_adds
  @foreign_key_adds
end

#foreign_key_dropsObject (readonly)

Returns the value of attribute foreign_key_drops


398
399
400
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 398

def foreign_key_drops
  @foreign_key_drops
end

Instance Method Details

#add_column(name, type, options) ⇒ Object


417
418
419
420
421
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 417

def add_column(name, type, options)
  name = name.to_s
  type = type.to_sym
  @adds << AddColumnDefinition.new(@td.new_column_definition(name, type, options))
end

#add_foreign_key(to_table, options) ⇒ Object


409
410
411
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 409

def add_foreign_key(to_table, options)
  @foreign_key_adds << ForeignKeyDefinition.new(name, to_table, options)
end

#drop_foreign_key(name) ⇒ Object


413
414
415
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 413

def drop_foreign_key(name)
  @foreign_key_drops << name
end

#nameObject


407
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 407

def name; @td.name; end