Class: ActiveRecord::ConnectionAdapters::PostgreSQL::Table
- Includes:
- ColumnMethods
- Defined in:
- activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb
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_key(*args) ⇒ Object
Removes the given unique constraint from the table.
-
#unique_key(*args) ⇒ Object
Adds an unique constraint.
Methods included from ColumnMethods
Methods included from ActiveSupport::Concern
#append_features, #class_methods, extended, #included, #prepend_features, #prepended
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")
293 294 295 |
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 293 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")
302 303 304 |
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 302 def remove_exclusion_constraint(*args) @base.remove_exclusion_constraint(name, *args) end |
#remove_unique_key(*args) ⇒ Object
Removes the given unique constraint from the table.
t.remove_unique_key(name: "unique_position")
320 321 322 |
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 320 def remove_unique_key(*args) @base.remove_unique_key(name, *args) end |
#unique_key(*args) ⇒ Object
Adds an unique constraint.
t.unique_key(:position, name: 'unique_position', deferrable: :deferred)
311 312 313 |
# File 'activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb', line 311 def unique_key(*args) @base.add_unique_key(name, *args) end |