Method: Sequel::Postgres::CreateTableGenerator#exclude
- Defined in:
- lib/sequel/adapters/shared/postgres.rb
#exclude(elements, opts = {}) ⇒ Object
Add an exclusion constraint when creating the table. elements should be an array of 2 element arrays, with the first element being the column or expression the exclusion constraint is applied to, and the second element being the operator to use for the column/expression to check for exclusion.
Example:
exclusion_constraint([[:col1, '&&'], [:col2, '=']])
# EXCLUDE USING gist (col1 WITH &&, col2 WITH =)
Options supported:
- :name
-
Name the constraint with the given name (useful if you may need to drop the constraint later)
- :using
-
Override the index_method for the exclusion constraint (defaults to gist).
- :where
-
Create a partial exclusion constraint, which only affects a subset of table rows, value should be a filter expression.
71 72 73 |
# File 'lib/sequel/adapters/shared/postgres.rb', line 71 def exclude(elements, opts={}) constraints << {:type => :exclude, :elements => elements}.merge(opts) end |