Skip to content
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

Add capability to check if numbers are unsigned when using CodeGen #1769

Closed
Asamsig opened this issue Jul 31, 2017 · 1 comment
Closed

Add capability to check if numbers are unsigned when using CodeGen #1769

Asamsig opened this issue Jul 31, 2017 · 1 comment

Comments

@Asamsig
Copy link
Contributor

Asamsig commented Jul 31, 2017

Currently when using CodeGen, with for example MySQL, if you have a table like:

CREATE TABLE my_table ( id UNSIGNED INT NOT NULL AUTO_INCREMENT PRIMARY KEY, something VARCHAR(100) )

It will generate a case class with id as a Scala Int, instead CodeGen should be able to read that it is an UNSIGNED INT and cast it to a Long instead, same goes for an UNSIGNED BIGINT which should be cast to a BigInteger and so on.

For a full list of what SIGNED/UNSIGNED numbers should be cast to see here.

Asamsig pushed a commit to Asamsig/slick that referenced this issue Sep 2, 2017
Added unsigned integer mapping to Long, following the MySQL connector reference. Added code for unsigned bigint aswell, but scala.math.BigInt isn't support as a default datatype, I left these parts in for completeness, but commented out. Updated the tests for the MySQLProfile to cover the new conversion.

Additionally fixed two typos, I spotted randomly.
trevorsibanda added a commit that referenced this issue Sep 2, 2017
issue #1769 Add support in the MySQLProfile for UNSIGNED INT
@Asamsig
Copy link
Contributor Author

Asamsig commented Sep 3, 2017

After investigating it doesn't seem like any of the other database than MySQL actually uses the UNSIGNED notation, so I guess this issue can be closed. Anybody who can confirm my findings?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants