Commit fbe13344 authored by zYne's avatar zYne

--no commit message

--no commit message
parent 92325291
...@@ -97,7 +97,7 @@ CREATE TABLE product ( ...@@ -97,7 +97,7 @@ CREATE TABLE product (
id INTEGER, id INTEGER,
price NUMERIC, price NUMERIC,
PRIMARY KEY(id), PRIMARY KEY(id),
CHECK (price > 0)) CHECK (price >= 0))
</code> </code>
So Doctrine optionally ensures even at the database level that the price of any product cannot be below zero. So Doctrine optionally ensures even at the database level that the price of any product cannot be below zero.
...@@ -122,8 +122,8 @@ CREATE TABLE product ( ...@@ -122,8 +122,8 @@ CREATE TABLE product (
id INTEGER, id INTEGER,
price NUMERIC, price NUMERIC,
PRIMARY KEY(id), PRIMARY KEY(id),
CHECK (price > 0), CHECK (price >= 0),
CHECK (price < 1000000)) CHECK (price <= 1000000))
</code> </code>
Lastly you can create any kind of CHECK constraints by using the check() method of the Doctrine_Record. In the last example we add constraint to ensure that price is always higher than the discounted price. Lastly you can create any kind of CHECK constraints by using the check() method of the Doctrine_Record. In the last example we add constraint to ensure that price is always higher than the discounted price.
...@@ -149,8 +149,8 @@ CREATE TABLE product ( ...@@ -149,8 +149,8 @@ CREATE TABLE product (
id INTEGER, id INTEGER,
price NUMERIC, price NUMERIC,
PRIMARY KEY(id), PRIMARY KEY(id),
CHECK (price > 0), CHECK (price >= 0),
CHECK (price < 1000000), CHECK (price <= 1000000),
CHECK (price > discounted_price)) CHECK (price > discounted_price))
</code> </code>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment