-
Notifications
You must be signed in to change notification settings - Fork 400
bugfix for #1662 - allow defaultValue for TEXT and BLOB fields (mariadb) #1993
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
base: master
Are you sure you want to change the base?
bugfix for #1662 - allow defaultValue for TEXT and BLOB fields (mariadb) #1993
Conversation
hevengo
commented
Mar 5, 2024
- removed blob/text default value checks
- implemented unquote of default values on TEXT/BLOB fields
- tested with mariadb 11.2.3
…t values on TEXT/BLOB fields
|
@hevengo can you please rebase your PR and force push the result? |
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 definitely needs tests which CI can run on both MariaDB and MySQL:
- a simple test case to prove setting a default on BLOB or TEXT works
- a case where the default value itself is wrapped in single quotes
| if ($default !== null) { | ||
| if (preg_match('~blob|text~', $nativeType)) { | ||
| // mariadb has extra single quotes on TEXT type default values, but not on other types | ||
| $default = preg_replace('@^\'(.*)\'$@', '$1', $row['Default']); |
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.
Please use $default instead of $row['Default'] on this line.
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.
Also, please use the more common regex delimiter / instead of @.
|
|
||
| // BLOBs can't have any default values in MySQL | ||
| $default = preg_match('~blob|text~', $nativeType) ? null : $row['Default']; | ||
|
|
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.
Please remove the empty line here.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1993 +/- ##
============================================
- Coverage 89.28% 89.28% -0.01%
+ Complexity 8058 8056 -2
============================================
Files 232 232
Lines 24534 24534
============================================
- Hits 21905 21904 -1
- Misses 2629 2630 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|