class Sequel::Postgres::AlterTableGenerator

Public Instance Methods

add_exclusion_constraint(elements, opts=OPTS) click to toggle source

Adds an exclusion constraint to an existing table, see CreateTableGenerator#exclude.

    # File lib/sequel/adapters/shared/postgres.rb
142 def add_exclusion_constraint(elements, opts=OPTS)
143   @operations << {:op => :add_constraint, :type => :exclude, :elements => elements}.merge!(opts)
144 end
alter_constraint(name, opts=OPTS) click to toggle source

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+)

    # File lib/sequel/adapters/shared/postgres.rb
153 def alter_constraint(name, opts=OPTS)
154   @operations << {:op => :alter_constraint, :name => name}.merge!(opts)
155 end
rename_constraint(name, new_name) click to toggle source
:inherit

Set true to use INHERIT, or false to use NO INHERIT (PostgreSQL 18+)

    # File lib/sequel/adapters/shared/postgres.rb
158 def rename_constraint(name, new_name)
159   @operations << {:op => :rename_constraint, :name => name, :new_name => new_name}
160 end
validate_constraint(name) click to toggle source

Validate the constraint with the given name, which should have been added previously with NOT VALID.

    # File lib/sequel/adapters/shared/postgres.rb
164 def validate_constraint(name)
165   @operations << {:op => :validate_constraint, :name => name}
166 end