Class: ActiveRecord::ConnectionAdapters::PostgreSQL::Table

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

Overview

Active Record PostgreSQL Adapter Table

Instance Attribute Summary

Attributes inherited from Table

#name

Instance Method Summary collapse

Methods included from ColumnMethods

#primary_key

Methods inherited from Table

#change, #change_default, #change_null, #check_constraint, #check_constraint_exists?, #column, #column_exists?, #foreign_key, #foreign_key_exists?, #index, #index_exists?, #initialize, #references, #remove, #remove_check_constraint, #remove_foreign_key, #remove_index, #remove_references, #remove_timestamps, #rename, #rename_index, #timestamps

Methods included from ColumnMethods

#primary_key

Constructor Details

This class inherits a constructor from ActiveRecord::ConnectionAdapters::Table

Instance Method Details

#exclusion_constraint(*args) ⇒ Object

Adds an exclusion constraint.

t.exclusion_constraint("price WITH =, availability_range WITH &&", using: :gist, name: "price_check")

See connection.add_exclusion_constraint



305
306
307
# File 'lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 305

def exclusion_constraint(*args)
  @base.add_exclusion_constraint(name, *args)
end

#remove_exclusion_constraint(*args) ⇒ Object

Removes the given exclusion constraint from the table.

t.remove_exclusion_constraint(name: "price_check")

See connection.remove_exclusion_constraint



314
315
316
# File 'lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 314

def remove_exclusion_constraint(*args)
  @base.remove_exclusion_constraint(name, *args)
end

#remove_unique_constraint(*args) ⇒ Object

Removes the given unique constraint from the table.

t.remove_unique_constraint(name: "unique_position")

See connection.remove_unique_constraint



332
333
334
# File 'lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 332

def remove_unique_constraint(*args)
  @base.remove_unique_constraint(name, *args)
end

#unique_constraint(*args) ⇒ Object

Adds a unique constraint.

t.unique_constraint(:position, name: 'unique_position', deferrable: :deferred)

See connection.add_unique_constraint



323
324
325
# File 'lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 323

def unique_constraint(*args)
  @base.add_unique_constraint(name, *args)
end