Class: Sequel::Postgres::AlterTableGenerator

Inherits:
Schema::AlterTableGenerator
  • Object
show all
Defined in:
lib/sequel/adapters/shared/postgres.rb

Instance Method Summary collapse

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

#rename_constraint(name, new_name) ⇒ Object

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



158
159
160
# File 'lib/sequel/adapters/shared/postgres.rb', line 158

def rename_constraint(name, new_name)
  @operations << {:op => :rename_constraint, :name => name, :new_name => new_name}
end

#validate_constraint(name) ⇒ Object

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



164
165
166
# File 'lib/sequel/adapters/shared/postgres.rb', line 164

def validate_constraint(name)
  @operations << {:op => :validate_constraint, :name => name}
end