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

Refactoring of Schema::normalizeDefaultValue() method #229

Merged
merged 4 commits into from
Jul 24, 2023

Conversation

Tigrov
Copy link
Member

@Tigrov Tigrov commented Jul 21, 2023

  • CURRENT_TIMESTAMP for default value was not Expression()
  • fix empty strings '' in default value
  • fix single quote in default value
  • fix DEFAULT NULL definition
Q A
Is bugfix? ✔️
New feature?
Breaks BC?
Fixed issues -

@what-the-diff
Copy link

what-the-diff bot commented Jul 21, 2023

PR Summary

  • Inclusion of new PHP built-in functions and updates to Schema.php
    The code now utilizes the PHP functions preg_match and str_replace to enhance data handling capabilities. The normalizeDefaultValue function has also been modified to handle null values or primary key situations, timestamp data type scenarios, and special characters within the default value more efficiently.

  • Enhancements to SchemaProvider.php and update to handling default values
    The module Expression from Yiisoft\Db\Expression\Expression; is being used to improve default value handling in the 'char_col2' field. A new field, 'nvarchar_col', has been added with settings optimized for character string data including default value settings, maximum size, and handling of null values.

  • Refinement to default value type for float_col field
    The handling of default values for the 'float_col' field has been updated to use an Expression instead of a raw string, thereby improving data accuracy and formatting consistency.

  • Updates to oci.sql in line with SchemaProvider modifications
    The 'char_col2' field's default setting has been adjusted to match those set in SchemaProvider.php. An additional 'nvarchar_col' field has been added, set to handle strings up to 100 characters in length and have a default value as an empty string.

@codecov
Copy link

codecov bot commented Jul 21, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.01 ⚠️

Comparison is base (fdd6eb0) 98.29% compared to head (f0b5a0d) 98.29%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #229      +/-   ##
============================================
- Coverage     98.29%   98.29%   -0.01%     
- Complexity      183      186       +3     
============================================
  Files            16       16              
  Lines           586      585       -1     
============================================
- Hits            576      575       -1     
  Misses           10       10              
Impacted Files Coverage Δ
src/Schema.php 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Tigrov Tigrov marked this pull request as ready for review July 21, 2023 08:45
@Tigrov Tigrov marked this pull request as draft July 21, 2023 10:40
@Tigrov Tigrov marked this pull request as ready for review July 21, 2023 10:47
Copy link
Member

@vjik vjik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add line to changelog

CHANGELOG.md Outdated Show resolved Hide resolved
@vjik vjik added the status:code review The pull request needs review. label Jul 21, 2023
@samdark samdark merged commit d936981 into yiisoft:master Jul 24, 2023
@samdark
Copy link
Member

samdark commented Jul 24, 2023

👍

@Tigrov Tigrov deleted the refactoring_normalize_default_value branch August 4, 2023 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:code review The pull request needs review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants