1
0
mirror of synced 2025-01-18 06:21:40 +03:00

added docs for notnull constraint

This commit is contained in:
zYne 2007-02-27 15:47:09 +00:00
parent 61ccabb692
commit da86fd8956

View File

@ -0,0 +1,19 @@
A not-null constraint simply specifies that a column must not assume the null value. A not-null constraint is always written as a column constraint.
The following definition uses a notnull constraint for column 'name'. This means that the specified column doesn't accept
null values.
<code type='php'>
class User extends Doctrine_Record
{
public function setTableDefinition()
{
$this->hasColumn('name', 'string', 200, array('notnull' => true,
'primary' => true));
}
}
</code>
When this class gets exported to database the following Sql statement would get executed (in Mysql):
CREATE TABLE user (name VARCHAR(200) NOT NULL, PRIMARY KEY(name))