Module: DbAgile::Contract::Robust::Helpers

Included in:
Adapter, Optimistic
Defined in:
lib/dbagile/contract/robust/helpers.rb

Instance Method Summary collapse

Instance Method Details

#has_table!(name, ex = nil) ⇒ Object

Asserts that a table exists or raises a NoSuchTableError

Raises:



7
8
9
# File 'lib/dbagile/contract/robust/helpers.rb', line 7

def has_table!(name, ex = nil)
  raise NoSuchTableError, "No such table #{name}" unless has_table?(name)
end

#not_has_table!(name, ex = nil) ⇒ Object

Asserts that a table does not exist or raises a TableAlreadyExistsError



12
13
14
# File 'lib/dbagile/contract/robust/helpers.rb', line 12

def not_has_table!(name, ex = nil)
  raise TableAlreadyExistsError, "No such table #{name}" if has_table?(name)
end