Class: ActiveRecord::ConnectionAdapters::PostgreSQL::AlterTable

Inherits:
AlterTable show all
Defined in:
activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb

Instance Attribute Summary collapse

Attributes inherited from AlterTable

#adds, #check_constraint_adds, #check_constraint_drops, #foreign_key_adds, #foreign_key_drops

Instance Method Summary collapse

Methods inherited from AlterTable

#add_check_constraint, #add_column, #add_foreign_key, #drop_check_constraint, #drop_foreign_key, #name

Constructor Details

#initialize(td) ⇒ AlterTable

Returns a new instance of AlterTable.



328
329
330
331
332
333
334
335
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 328

def initialize(td)
  super
  @constraint_validations = []
  @exclusion_constraint_adds = []
  @exclusion_constraint_drops = []
  @unique_key_adds = []
  @unique_key_drops = []
end

Instance Attribute Details

#constraint_validationsObject (readonly)

Returns the value of attribute constraint_validations



326
327
328
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 326

def constraint_validations
  @constraint_validations
end

#exclusion_constraint_addsObject (readonly)

Returns the value of attribute exclusion_constraint_adds



326
327
328
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 326

def exclusion_constraint_adds
  @exclusion_constraint_adds
end

#exclusion_constraint_dropsObject (readonly)

Returns the value of attribute exclusion_constraint_drops



326
327
328
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 326

def exclusion_constraint_drops
  @exclusion_constraint_drops
end

#unique_key_addsObject (readonly)

Returns the value of attribute unique_key_adds



326
327
328
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 326

def unique_key_adds
  @unique_key_adds
end

#unique_key_dropsObject (readonly)

Returns the value of attribute unique_key_drops



326
327
328
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 326

def unique_key_drops
  @unique_key_drops
end

Instance Method Details

#add_exclusion_constraint(expression, options) ⇒ Object



341
342
343
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 341

def add_exclusion_constraint(expression, options)
  @exclusion_constraint_adds << @td.new_exclusion_constraint_definition(expression, options)
end

#add_unique_key(column_name, options) ⇒ Object



349
350
351
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 349

def add_unique_key(column_name, options)
  @unique_key_adds << @td.new_unique_key_definition(column_name, options)
end

#drop_exclusion_constraint(constraint_name) ⇒ Object



345
346
347
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 345

def drop_exclusion_constraint(constraint_name)
  @exclusion_constraint_drops << constraint_name
end

#drop_unique_key(unique_key_name) ⇒ Object



353
354
355
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 353

def drop_unique_key(unique_key_name)
  @unique_key_drops << unique_key_name
end

#validate_constraint(name) ⇒ Object



337
338
339
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 337

def validate_constraint(name)
  @constraint_validations << name
end