module AssociateJsonb::ConnectionAdapters::TableDefinition

Attributes

constraints[R]

Public Class Methods

new(*,**) click to toggle source
Calls superclass method
# File lib/associate_jsonb/connection_adapters/schema_definitions/table_definition.rb, line 9
def initialize(*,**)
  super
  @constraints = []
end

Public Instance Methods

constraint(name = nil, **opts) click to toggle source
# File lib/associate_jsonb/connection_adapters/schema_definitions/table_definition.rb, line 14
def constraint(name = nil, **opts)
  unless opts[:value].present?
    raise ArgumentError.new("Invalid Drop Constraint Options")
  end

  @constraints << ConstraintDefinition.new(
    **opts.reverse_merge(name: name)
  )
end