-
-
Notifications
You must be signed in to change notification settings - Fork 17
Consider platform integer size in ColumnBuilder::bigint() + Throw exception on "unsigned" column usage
#460
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
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #460 +/- ##
============================================
- Coverage 99.67% 99.45% -0.22%
- Complexity 316 320 +4
============================================
Files 36 36
Lines 919 925 +6
============================================
+ Hits 916 920 +4
- Misses 3 5 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ColumnBuilder::bigint()ColumnBuilder::bigint() + Throw exception on "unsigned" column usage
| if ($column->isUnsigned()) { | ||
| throw new NotSupportedException('The "unsigned" attribute is not supported by PostgreSQL.'); | ||
| } |
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.
I'd just ignore this. Or as an option we can add CHECK (column >= 0)
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.
Unsigned columns often usage for big values. Exception will alert the user that this is not available.
| public function fromPseudoType(string $pseudoType, array $info = []): ColumnInterface | ||
| { | ||
| // PostgreSQL doesn't support unsigned types | ||
| return parent::fromPseudoType($pseudoType, $info)->unsigned(false); |
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.
I do not think that this is correct. There are ways how to get unsigned type (with check)
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.
Unsigned in most cases (almost always?) is added for store big values, not for non-negative values constraint.
Related to yiisoft/db#1095