Commit 59514e4e authored by Daniel Chesterton's avatar Daniel Chesterton Committed by Steve Müller

Disallow AUTO_INCREMENT on decimal/float

parent 819a4672
......@@ -809,7 +809,7 @@ class MySqlPlatform extends AbstractPlatform
*/
public function getFloatDeclarationSQL(array $field)
{
return 'DOUBLE PRECISION' . $this->_getCommonIntegerTypeDeclarationSQL($field);
return 'DOUBLE PRECISION' . $this->getUnsignedDeclaration($field);
}
/**
......@@ -818,7 +818,19 @@ class MySqlPlatform extends AbstractPlatform
public function getDecimalTypeDeclarationSQL(array $columnDef)
{
$declaration = parent::getDecimalTypeDeclarationSQL($columnDef);
return $declaration . $this->_getCommonIntegerTypeDeclarationSQL($columnDef);
return $declaration . $this->getUnsignedDeclaration($columnDef);
}
/**
* Get unsigned declaration for a column.
*
* @param array $columnDef
*
* @return string
*/
private function getUnsignedDeclaration(array $columnDef)
{
return (isset($columnDef['unsigned']) && $columnDef['unsigned']) ? ' UNSIGNED' : '';
}
/**
......@@ -830,9 +842,8 @@ class MySqlPlatform extends AbstractPlatform
if ( ! empty($columnDef['autoincrement'])) {
$autoinc = ' AUTO_INCREMENT';
}
$unsigned = (isset($columnDef['unsigned']) && $columnDef['unsigned']) ? ' UNSIGNED' : '';
return $unsigned . $autoinc;
return $this->getUnsignedDeclaration($columnDef) . $autoinc;
}
/**
......
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