This commit is contained in:
parent
23025b5872
commit
cfaa5f121f
@ -180,7 +180,19 @@ class Doctrine_Export_Sqlite extends Doctrine_Export
|
||||
}
|
||||
|
||||
$name = $this->conn->quoteIdentifier($name, true);
|
||||
$query[] = 'CREATE TABLE ' . $name . ' (' . $queryFields . ')';
|
||||
$sql = 'CREATE TABLE ' . $name . ' (' . $queryFields . ')';
|
||||
|
||||
if ($check = $this->getCheckDeclaration($fields)) {
|
||||
$sql .= ', ' . $check;
|
||||
}
|
||||
|
||||
if (isset($options['checks']) && $check = $this->getCheckDeclaration($options['checks'])) {
|
||||
$sql .= ', ' . $check;
|
||||
}
|
||||
|
||||
$sql .= ')';
|
||||
|
||||
$query[] = $sql;
|
||||
|
||||
if (isset($options['indexes']) && ! empty($options['indexes'])) {
|
||||
foreach ($options['indexes'] as $index => $definition) {
|
||||
|
@ -121,7 +121,9 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
*
|
||||
* -- foreignKeys the foreign keys of this table
|
||||
*
|
||||
* -- collation
|
||||
* -- checks the check constraints of this table, eg. 'price > dicounted_price'
|
||||
*
|
||||
* -- collation collation attribute
|
||||
*
|
||||
* -- indexes the index definitions of this table
|
||||
*
|
||||
@ -468,6 +470,23 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
{
|
||||
$this->options['foreignKeys'][] = $definition;
|
||||
}
|
||||
/**
|
||||
* addCheckConstraint
|
||||
*
|
||||
* adds a check constraint to this table
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addCheckConstraint($definition, $name)
|
||||
{
|
||||
if (is_string($name)) {
|
||||
$this->options['checks'][$name] = $definition;
|
||||
} else {
|
||||
$this->options['checks'][] = $definition;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* addIndex
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user