Module: AssociateJsonb::ConnectionAdapters::TableDefinition

Defined in:
lib/associate_jsonb/connection_adapters/schema_definitions/table_definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#constraintsObject (readonly)

Returns the value of attribute constraints.



7
8
9
# File 'lib/associate_jsonb/connection_adapters/schema_definitions/table_definition.rb', line 7

def constraints
  @constraints
end

Instance Method Details

#constraint(name = nil, **opts) ⇒ Object



14
15
16
17
18
19
20
21
22
# 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

#initializeObject



9
10
11
12
# File 'lib/associate_jsonb/connection_adapters/schema_definitions/table_definition.rb', line 9

def initialize(*,**)
  super
  @constraints = []
end