class ActiveRecord::ConnectionAdapters::PostgreSQL::Table
Active Record PostgreSQL Adapter Table¶ ↑
Public Instance Methods
Source
# File lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 311 def exclusion_constraint(...) @base.add_exclusion_constraint(name, ...) end
Adds an exclusion constraint.
t.exclusion_constraint("price WITH =, availability_range WITH &&", using: :gist, name: "price_check")
Source
# File lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 320 def remove_exclusion_constraint(...) @base.remove_exclusion_constraint(name, ...) end
Removes the given exclusion constraint from the table.
t.remove_exclusion_constraint(name: "price_check")
Source
# File lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 338 def remove_unique_constraint(...) @base.remove_unique_constraint(name, ...) end
Removes the given unique constraint from the table.
t.remove_unique_constraint(name: "unique_position")
Source
# File lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 329 def unique_constraint(...) @base.add_unique_constraint(name, ...) end
Adds a unique constraint.
t.unique_constraint(:position, name: 'unique_position', deferrable: :deferred, nulls_not_distinct: true)
Source
# File lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 358 def validate_check_constraint(...) @base.validate_check_constraint(name, ...) end
Validates the given check constraint on the table
t.check_constraint("price > 0", name: "price_check", validate: false) t.validate_check_constraint name: "price_check"
Source
# File lib/active_record/connection_adapters/postgresql/schema_definitions.rb, line 348 def validate_constraint(...) @base.validate_constraint(name, ...) end
Validates the given constraint on the table.
t.check_constraint("price > 0", name: "price_check", validate: false) t.validate_constraint "price_check"