Module: SexyPgConstraints::SchemaDefinitions

Defined in:
lib/sexy_pg_constraints/schema_definitions.rb

Instance Method Summary collapse

Instance Method Details

#constrain(*args) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/sexy_pg_constraints/schema_definitions.rb', line 6

def constrain(*args)
  if block_given?
    yield SexyPgConstraints::Constrainer.new(args[0].to_s)
  else
    SexyPgConstraints::Constrainer::add_constraints(*args)
  end
end

#deconstrain(*args) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/sexy_pg_constraints/schema_definitions.rb', line 14

def deconstrain(*args)
  if block_given?
    yield SexyPgConstraints::Deconstrainer.new(args[0])
  else
    SexyPgConstraints::Deconstrainer::drop_constraints(*args)
  end
end