Module: Sequel::ConstraintValidations::CreateTableGeneratorMethods

Included in:
AlterTableGeneratorMethods
Defined in:
lib/sequel/extensions/constraint_validations.rb

Overview

Additional methods for the create_table generator to support constraint validations.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#validationsObject (readonly)

An array of stored validation metadata, used later by the database to create constraints.



213
214
215
# File 'lib/sequel/extensions/constraint_validations.rb', line 213

def validations
  @validations
end

Instance Method Details

#validate(&block) ⇒ Object

Call into the validate DSL for creating constraint validations.



221
222
223
# File 'lib/sequel/extensions/constraint_validations.rb', line 221

def validate(&block)
  Generator.new(self).process(&block)
end

#validation(opts) ⇒ Object

Add a validation metadata hash to the stored array.



216
217
218
# File 'lib/sequel/extensions/constraint_validations.rb', line 216

def validation(opts)
  @validations << opts
end