Class: ActiveRecord::ConnectionAdapters::PostgreSQL::Table
- 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
Instance Method Summary collapse
-
#exclusion_constraint(*args) ⇒ Object
Adds an exclusion constraint.
-
#remove_exclusion_constraint(*args) ⇒ Object
Removes the given exclusion constraint from the table.
-
#remove_unique_constraint(*args) ⇒ Object
Removes the given unique constraint from the table.
-
#unique_constraint(*args) ⇒ Object
Adds a unique constraint.
-
#validate_check_constraint(*args) ⇒ Object
Validates the given check constraint on the table.
-
#validate_constraint(*args) ⇒ Object
Validates the given constraint on the table.
Methods included from ColumnMethods
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
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")
309 310 311 |
# File 'lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 309 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")
318 319 320 |
# File 'lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 318 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")
336 337 338 |
# File 'lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 336 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, nulls_not_distinct: true)
327 328 329 |
# File 'lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 327 def unique_constraint(*args) @base.add_unique_constraint(name, *args) end |
#validate_check_constraint(*args) ⇒ Object
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"
356 357 358 |
# File 'lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 356 def validate_check_constraint(*args) @base.validate_check_constraint(name, *args) end |
#validate_constraint(*args) ⇒ Object
Validates the given constraint on the table.
t.check_constraint("price > 0", name: "price_check", validate: false)
t.validate_constraint "price_check"
346 347 348 |
# File 'lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 346 def validate_constraint(*args) @base.validate_constraint(name, *args) end |