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

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

Overview

Active Record PostgreSQL Adapter Alter Table

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.



361
362
363
364
365
366
367
368
# File 'lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 361

def initialize(td)
  super
  @constraint_validations = []
  @exclusion_constraint_adds = []
  @exclusion_constraint_drops = []
  @unique_constraint_adds = []
  @unique_constraint_drops = []
end

Instance Attribute Details

#constraint_validationsObject (readonly)

Returns the value of attribute constraint_validations.



359
360
361
# File 'lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 359

def constraint_validations
  @constraint_validations
end

#exclusion_constraint_addsObject (readonly)

Returns the value of attribute exclusion_constraint_adds.



359
360
361
# File 'lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 359

def exclusion_constraint_adds
  @exclusion_constraint_adds
end

#exclusion_constraint_dropsObject (readonly)

Returns the value of attribute exclusion_constraint_drops.



359
360
361
# File 'lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 359

def exclusion_constraint_drops
  @exclusion_constraint_drops
end

#unique_constraint_addsObject (readonly)

Returns the value of attribute unique_constraint_adds.



359
360
361
# File 'lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 359

def unique_constraint_adds
  @unique_constraint_adds
end

#unique_constraint_dropsObject (readonly)

Returns the value of attribute unique_constraint_drops.



359
360
361
# File 'lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 359

def unique_constraint_drops
  @unique_constraint_drops
end

Instance Method Details

#add_exclusion_constraint(expression, options) ⇒ Object



374
375
376
# File 'lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 374

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

#add_unique_constraint(column_name, options) ⇒ Object



382
383
384
# File 'lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 382

def add_unique_constraint(column_name, options)
  @unique_constraint_adds << @td.new_unique_constraint_definition(column_name, options)
end

#drop_exclusion_constraint(constraint_name) ⇒ Object



378
379
380
# File 'lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 378

def drop_exclusion_constraint(constraint_name)
  @exclusion_constraint_drops << constraint_name
end

#drop_unique_constraint(unique_constraint_name) ⇒ Object



386
387
388
# File 'lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 386

def drop_unique_constraint(unique_constraint_name)
  @unique_constraint_drops << unique_constraint_name
end

#validate_constraint(name) ⇒ Object



370
371
372
# File 'lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 370

def validate_constraint(name)
  @constraint_validations << name
end