Module: Postgresql::Check::TableDefinition
- Defined in:
- lib/postgresql/check/table_definition.rb
Instance Method Summary collapse
-
#check(condition, options) ⇒ Object
Add new check constraint to table.
- #checks ⇒ Object
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, ) checks << [condition, ] end |
#checks ⇒ Object
15 16 17 |
# File 'lib/postgresql/check/table_definition.rb', line 15 def checks @checks ||= [] end |