8000 [DBAL-1082] Fix SchemaTool does not generate SQL for MySQL unsigned float by dchesterton · Pull Request #749 · doctrine/dbal · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[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

Closed
wants to merge 5 commits into from
Closed

Conversation

dchesterton
Copy link
Contributor

@doctrinebot
Copy link

Hello,

thank you for creating this pull request. I have automatically opened an issue
on our Jira Bug Tracker for you. See the issue link:

http://www.doctrine-project.org/jira/browse/DBAL-1083

We use Jira to track the state of pull requests and the versions they got
included in.

@dchesterton
Copy link
Contributor Author

Also added support for unsigned decimal fields

public function getDecimalTypeDeclarationSQL(array $columnDef)
{
$declaration = parent::getDecimalTypeDeclarationSQL($columnDef);
return $declaration . $this->_getCommonIntegerTypeDeclarationSQL($columnDef);
Copy link
Member

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

Copy link
Contributor Author

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' : '';
Copy link
Member

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' : '';

Copy link
Contributor Author

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);
Copy link
Member

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

@deeky666
Copy link
Member

Needs SQL generation test cases. Also a functional test case in MySqlSchemaManagerTest would be appreciated ensuring that the unsigned property gets introspected by the schema manager correctly.

@deeky666 deeky666 closed this in e344121 Jan 3, 2015
@deeky666
Copy link
Member
deeky666 commented Jan 3, 2015

Merged manually, thx @dchesterton !

@dchesterton
Copy link
Contributor Author

No worries, thanks for adding the tests.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0