Class: ActiveRecord::ConnectionAdapters::PostgreSQL::AlterTable
- Inherits:
-
AlterTable
- Object
- AlterTable
- ActiveRecord::ConnectionAdapters::PostgreSQL::AlterTable
- Defined in:
- activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb
Overview
Active Record PostgreSQL Adapter Alter Table
Instance Attribute Summary collapse
-
#constraint_validations ⇒ Object
readonly
Returns the value of attribute constraint_validations.
-
#exclusion_constraint_adds ⇒ Object
readonly
Returns the value of attribute exclusion_constraint_adds.
-
#unique_constraint_adds ⇒ Object
readonly
Returns the value of attribute unique_constraint_adds.
Attributes inherited from AlterTable
#adds, #check_constraint_adds, #check_constraint_drops, #constraint_drops, #foreign_key_adds, #foreign_key_drops
Instance Method Summary collapse
- #add_exclusion_constraint(expression, options) ⇒ Object
- #add_unique_constraint(column_name, options) ⇒ Object
-
#initialize(td) ⇒ AlterTable
constructor
A new instance of AlterTable.
- #validate_constraint(name) ⇒ Object
Methods inherited from AlterTable
#add_check_constraint, #add_column, #add_foreign_key, #drop_check_constraint, #drop_constraint, #drop_foreign_key, #name
Constructor Details
#initialize(td) ⇒ AlterTable
Returns a new instance of AlterTable.
365 366 367 368 369 370 |
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 365 def initialize(td) super @constraint_validations = [] @exclusion_constraint_adds = [] @unique_constraint_adds = [] end |
Instance Attribute Details
#constraint_validations ⇒ Object (readonly)
Returns the value of attribute constraint_validations.
363 364 365 |
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 363 def constraint_validations @constraint_validations end |
#exclusion_constraint_adds ⇒ Object (readonly)
Returns the value of attribute exclusion_constraint_adds.
363 364 365 |
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 363 def exclusion_constraint_adds @exclusion_constraint_adds end |
#unique_constraint_adds ⇒ Object (readonly)
Returns the value of attribute unique_constraint_adds.
363 364 365 |
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 363 def unique_constraint_adds @unique_constraint_adds end |
Instance Method Details
#add_exclusion_constraint(expression, options) ⇒ Object
376 377 378 |
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 376 def add_exclusion_constraint(expression, ) @exclusion_constraint_adds << @td.new_exclusion_constraint_definition(expression, ) end |
#add_unique_constraint(column_name, options) ⇒ Object
380 381 382 |
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 380 def add_unique_constraint(column_name, ) @unique_constraint_adds << @td.new_unique_constraint_definition(column_name, ) end |
#validate_constraint(name) ⇒ Object
372 373 374 |
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 372 def validate_constraint(name) @constraint_validations << name end |