Make sure default values in schema columns are always non-empty (especially booleans).

This commit is contained in:
Franz Liedke
2012-07-17 23:47:05 +02:00
parent 25b8bd889b
commit 61364c553d
5 changed files with 19 additions and 4 deletions

View File

@@ -96,4 +96,19 @@ abstract class Grammar extends \Laravel\Database\Grammar {
return $this->{'type_'.$column->type}($column);
}
/**
* Format a value so that it can be used in SQL DEFAULT clauses.
* @param mixed $value
* @return string
*/
protected function default_value($value)
{
if (is_bool($value))
{
return intval($value);
}
return strval($value);
}
}