yii2
yii2 copied to clipboard
Migration & MySql Query addCheck() and dropCheck()
Q | A |
---|---|
Is bugfix? | ✔️ |
New feature? | ❌ |
Breaks BC? | ❌ |
Fixed issues | #19817, #19819 |
PR Summary
-
Check Constraint Management in Migration Class In the Migration file (
framework/db/Migration.php
), two new methods are introduced. TheaddCheck
method is created to generate a SQL command that adds a rule - a check constraint, to an existing database table. Similarly, thedropCheck
method is introduced to compose a SQL command for removing any check constraint from a database table. -
Removal of Unsupported Methods in MySQL Query Builder In the MySQL Query Builder file (
framework/db/mysql/QueryBuilder.php
),addCheck
anddropCheck
methods are discarded. The motivation behind this action is that MySQL does not support these operations, hence removing them improves the overall robustness and reliability of this part of the system.
Codecov Report
Attention: Patch coverage is 0%
with 31 lines
in your changes are missing coverage. Please review.
Project coverage is 60.49%. Comparing base (
391997a
) to head (bd73df5
). Report is 1 commits behind head on master.
:exclamation: Current head bd73df5 differs from pull request most recent head 2ead4f3
Please upload reports for the commit 2ead4f3 to get more accurate results.
Files | Patch % | Lines |
---|---|---|
framework/db/mysql/Schema.php | 0.00% | 23 Missing :warning: |
framework/db/Migration.php | 0.00% | 8 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #19881 +/- ##
=============================================
+ Coverage 18.65% 60.49% +41.84%
- Complexity 11379 11383 +4
=============================================
Files 430 430
Lines 37071 37103 +32
=============================================
+ Hits 6915 22445 +15530
+ Misses 30156 14658 -15498
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
hi, @bobonov, would have time to apply the suggestions, to finish the PR,
Thks.
Hi, add line in changelog,
Thks,
@bobonov Thanks for the PR. Would you please work on the comments, notably change log entries, so that the PR can be merged?
I think we need to enable MySQL tests for this feature:
https://github.com/yiisoft/yii2/blob/f2ea9be24225987b2acf2d6fdd2789e0a32b7fb0/tests/framework/db/mysql/CommandTest.php#L20
done.
This PR needs to be updated, since for Yii2 to correctly support addCheck()
and dropCheck()
in MySQL, loadTableChecks()
must be implemented for MySQL 8.0.16
or higher, so it is in progress.
The PR title and changelog need to be updated too, since it does more than add/drop check
Please if you can take a look, all the tests work,
Thks.
@rob006 @bizley @darkdef
@rob006 @darkdef @rhertogh can you review this PR? Would like to see it merged before end of this week, if we can make that happen!
Thanks everyone and especially @bobonov and @terabytesoftw for your work on the PR