Class: ActiveRecord::ConnectionAdapters::AlterTable
- Defined in:
- activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Attribute Summary collapse
-
#adds ⇒ Object
readonly
Returns the value of attribute adds.
-
#check_constraint_adds ⇒ Object
readonly
Returns the value of attribute check_constraint_adds.
-
#check_constraint_drops ⇒ Object
readonly
Returns the value of attribute check_constraint_drops.
-
#constraint_drops ⇒ Object
readonly
Returns the value of attribute constraint_drops.
-
#foreign_key_adds ⇒ Object
readonly
Returns the value of attribute foreign_key_adds.
-
#foreign_key_drops ⇒ Object
readonly
Returns the value of attribute foreign_key_drops.
Instance Method Summary collapse
- #add_check_constraint(expression, options) ⇒ Object
- #add_column(name, type, **options) ⇒ Object
- #add_foreign_key(to_table, options) ⇒ Object
- #drop_check_constraint(constraint_name) ⇒ Object
- #drop_constraint(constraint_name) ⇒ Object
- #drop_foreign_key(name) ⇒ Object
-
#initialize(td) ⇒ AlterTable
constructor
A new instance of AlterTable.
- #name ⇒ Object
Constructor Details
#initialize(td) ⇒ AlterTable
Returns a new instance of AlterTable.
618 619 620 621 622 623 624 625 626 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 618 def initialize(td) @td = td @adds = [] @foreign_key_adds = [] @foreign_key_drops = [] @check_constraint_adds = [] @check_constraint_drops = [] @constraint_drops = [] end |
Instance Attribute Details
#adds ⇒ Object (readonly)
Returns the value of attribute adds.
613 614 615 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 613 def adds @adds end |
#check_constraint_adds ⇒ Object (readonly)
Returns the value of attribute check_constraint_adds.
615 616 617 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 615 def check_constraint_adds @check_constraint_adds end |
#check_constraint_drops ⇒ Object (readonly)
Returns the value of attribute check_constraint_drops.
615 616 617 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 615 def check_constraint_drops @check_constraint_drops end |
#constraint_drops ⇒ Object (readonly)
Returns the value of attribute constraint_drops.
616 617 618 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 616 def constraint_drops @constraint_drops end |
#foreign_key_adds ⇒ Object (readonly)
Returns the value of attribute foreign_key_adds.
614 615 616 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 614 def foreign_key_adds @foreign_key_adds end |
#foreign_key_drops ⇒ Object (readonly)
Returns the value of attribute foreign_key_drops.
614 615 616 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 614 def foreign_key_drops @foreign_key_drops end |
Instance Method Details
#add_check_constraint(expression, options) ⇒ Object
638 639 640 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 638 def add_check_constraint(expression, ) @check_constraint_adds << @td.new_check_constraint_definition(expression, ) end |
#add_column(name, type, **options) ⇒ Object
650 651 652 653 654 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 650 def add_column(name, type, **) name = name.to_s type = type.to_sym @adds << AddColumnDefinition.new(@td.new_column_definition(name, type, **)) end |
#add_foreign_key(to_table, options) ⇒ Object
630 631 632 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 630 def add_foreign_key(to_table, ) @foreign_key_adds << @td.new_foreign_key_definition(to_table, ) end |
#drop_check_constraint(constraint_name) ⇒ Object
642 643 644 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 642 def drop_check_constraint(constraint_name) @check_constraint_drops << constraint_name end |
#drop_constraint(constraint_name) ⇒ Object
646 647 648 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 646 def drop_constraint(constraint_name) @constraint_drops << constraint_name end |
#drop_foreign_key(name) ⇒ Object
634 635 636 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 634 def drop_foreign_key(name) @foreign_key_drops << name end |
#name ⇒ Object
628 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 628 def name; @td.name; end |