-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[DBAL-1082] Fix SchemaTool does not generate SQL for MySQL unsigned float #749
8000 New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hello, thank you for creating this pull request. I have automatically opened an issue http://www.doctrine-project.org/jira/browse/DBAL-1083 We use Jira to track the state of pull requests and the versions they got |
Also added support for unsigned decimal fields |
public function getDecimalTypeDeclarationSQL(array $columnDef) | ||
{ | ||
$declaration = parent::getDecimalTypeDeclarationSQL($columnDef); | ||
return $declaration . $this->_getCommonIntegerTypeDeclarationSQL($columnDef); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would allow to mark a float or a decimal field as autoincrement, which is wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I've fixed it now.
*/ | ||
private function getUnsignedDeclaration(array $columnDef) | ||
{ | ||
return (isset($columnDef['unsigned']) && $columnDef['unsigned']) ? ' UNSIGNED' : ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be simplified using return !empty($columnDef['unsigned']) ? ' UNSIGNED' : '';
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stof done
public function getDecimalTypeDeclarationSQL(array $columnDef) | ||
{ | ||
$declaration = parent::getDecimalTypeDeclarationSQL($columnDef); | ||
return $declaration . $this->getUnsignedDeclaration($columnDef); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can make this a one liner
Needs SQL generation test cases. Also a functional test case in |
Merged manually, thx @dchesterton ! |
No worries, thanks for adding the tests. |
Fix for http://www.doctrine-project.org/jira/browse/DBAL-1082