Commit ef02cc72 authored by David Desberg's avatar David Desberg Committed by Benjamin Eberlei

Applied stof's suggestions

parent 2e9e9156
......@@ -898,29 +898,30 @@ class SQLServerPlatform extends AbstractPlatform
}
/**
* Obtain DBMS specific SQL code portion needed to set a default value
* declaration to be used in statements like CREATE TABLE.
*
* @param array $field field definition array
*
* @return string DBMS specific SQL code portion needed to set a default value
* {@inheritDoc}
*/
public function getDefaultValueDeclarationSQL($field)
{
$default = empty($field['notnull']) ? ' NULL' : '';
if ( ! isset($field['default'])) {
return empty($field['notnull']) ? ' NULL' : '';
}
if (isset($field['default'])) {
$default = " DEFAULT '".$field['default']."'";
if (isset($field['type'])) {
if (in_array((string)$field['type'], array("Integer", "BigInteger", "SmallInteger"))) {
$default = " DEFAULT ".$field['default'];
} else if ((string)$field['type'] == 'DateTime' && $field['default'] == $this->getCurrentTimestampSQL()) {
$default = " DEFAULT ".$this->getCurrentTimestampSQL();
} else if ((string) $field['type'] == 'Boolean') {
$default = " DEFAULT '" . $this->convertBooleans($field['default']) . "'";
if ( ! isset($field['type'])) {
return " DEFAULT '" . $field['default'] . "'";
}
if (in_array((string) $field['type'], array('Integer', 'BigInteger', 'SmallInteger'))) {
return " DEFAULT " . $field['default'];
}
if ((string) $field['type'] == 'DateTime' && $field['default'] == $this->getCurrentTimestampSQL()) {
return " DEFAULT " . $this->getCurrentTimestampSQL();
}
if ((string) $field['type'] == 'Boolean') {
return " DEFAULT '" . $this->convertBooleans($field['default']) . "'";
}
return $default;
return " DEFAULT '" . $field['default'] . "'";
}
}
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