Class: Sequel::Postgres::AlterTableGenerator
- Inherits:
-
Schema::AlterTableGenerator
- Object
- Schema::AlterTableGenerator
- Sequel::Postgres::AlterTableGenerator
- Defined in:
- lib/sequel/adapters/shared/postgres.rb
Instance Attribute Summary
Attributes inherited from Schema::AlterTableGenerator
Instance Method Summary collapse
-
#add_exclusion_constraint(elements, opts = OPTS) ⇒ Object
Adds an exclusion constraint to an existing table, see CreateTableGenerator#exclude.
-
#alter_constraint(name, opts = OPTS) ⇒ Object
Alter an existing constraint.
-
#validate_constraint(name) ⇒ Object
Validate the constraint with the given name, which should have been added previously with NOT VALID.
Methods inherited from Schema::AlterTableGenerator
#add_column, #add_constraint, #add_foreign_key, #add_full_text_index, #add_index, #add_primary_key, #add_spatial_index, #add_unique_constraint, #drop_column, #drop_constraint, #drop_foreign_key, #drop_index, #initialize, #rename_column, #set_column_allow_null, #set_column_default, #set_column_not_null, #set_column_type
Constructor Details
This class inherits a constructor from Sequel::Schema::AlterTableGenerator
Instance Method Details
#add_exclusion_constraint(elements, opts = OPTS) ⇒ Object
Adds an exclusion constraint to an existing table, see CreateTableGenerator#exclude.
142 143 144 |
# File 'lib/sequel/adapters/shared/postgres.rb', line 142 def add_exclusion_constraint(elements, opts=OPTS) @operations << {:op => :add_constraint, :type => :exclude, :elements => elements}.merge!(opts) end |
#alter_constraint(name, opts = OPTS) ⇒ Object
Alter an existing constraint. Options:
- :deferrable
-
Modify deferrable setting for constraint (PostgreSQL 9.4+):
- true
-
DEFERRABLE INITIALLY DEFERRED
- false
-
NOT DEFERRABLE
- :immediate
-
DEFERRABLE INITIALLY IMMEDIATE
- :enforced
-
Set true to use ENFORCED, or false to use NOT ENFORCED (PostgreSQL 18+)
- :inherit
-
Set true to use INHERIT, or false to use NO INHERIT (PostgreSQL 18+)
153 154 155 |
# File 'lib/sequel/adapters/shared/postgres.rb', line 153 def alter_constraint(name, opts=OPTS) @operations << {:op => :alter_constraint, :name => name}.merge!(opts) end |
#validate_constraint(name) ⇒ Object
Validate the constraint with the given name, which should have been added previously with NOT VALID.
159 160 161 |
# File 'lib/sequel/adapters/shared/postgres.rb', line 159 def validate_constraint(name) @operations << {:op => :validate_constraint, :name => name} end |