Module: Postgresql::Check::TableDefinition

Defined in:
lib/postgresql/check/table_definition.rb

Instance Method Summary collapse

Instance Method Details

#check(condition, options) ⇒ Object

Add new check constraint to table

Example:

create_table :goods do |t|
  t.float :price
  t.check 'price > 0', :name => 'goods_price_gt_0_check'
end


11
12
13
# File 'lib/postgresql/check/table_definition.rb', line 11

def check(condition, options)
  checks << [condition, options]
end

#checksObject



15
16
17
# File 'lib/postgresql/check/table_definition.rb', line 15

def checks
  @checks ||= []
end