class ActiveRecord::ConnectionAdapters::PostgreSQL::Table
Active Record PostgreSQL
Adapter Table
Inherits From
-
class
ActiveRecord::
ConnectionAdapters:: Table -
module
ActiveRecord::
ConnectionAdapters:: PostgreSQL:: ColumnMethods
Public instance methods
Adds an exclusion constraint.
t.exclusion_constraint("price WITH =, availability_range WITH &&", using: :gist, name: "price_check")
Source code GitHub
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 305
def exclusion_constraint(*args)
@base.add_exclusion_constraint(name, *args)
end
Removes the given exclusion constraint from the table.
t.remove_exclusion_constraint(name: "price_check")
Source code GitHub
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 314
def remove_exclusion_constraint(*args)
@base.remove_exclusion_constraint(name, *args)
end
Removes the given unique constraint from the table.
t.remove_unique_constraint(name: "unique_position")
Source code GitHub
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 332
def remove_unique_constraint(*args)
@base.remove_unique_constraint(name, *args)
end
Adds a unique constraint.
t.unique_constraint(:position, name: 'unique_position', deferrable: :deferred)
Source code GitHub
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 323
def unique_constraint(*args)
@base.add_unique_constraint(name, *args)
end