Skip to content

New: Add MySQL implementation of UuidValue expression - #482

Merged
Tigrov merged 6 commits into
yiisoft:masterfrom
KalimeroMK:add-1152-uuid-value
Sep 14, 2026
Merged

Tigrov merged 6 commits into
yiisoft:masterfrom
KalimeroMK:add-1152-uuid-value

Conversation

@KalimeroMK

Copy link
Copy Markdown
Contributor
Q A
Is bugfix? ❌
New feature? ✔️
Breaks BC? ❌
Fixed issues

MySQL/MariaDB half of UuidValue, added in yiisoft/db#1199 — that PR has to be merged first.

Both store a UUID as 16 raw bytes (ColumnDefinitionBuilder maps ColumnType::UUID to binary(16)), so prepareValue() converts the canonical form with DbUuidHelper::uuidToBlob() and binds it as DataType::LOB rather than letting buildValue() infer DataType::STRING:

$db->createCommand()->insert('{{%page}}', ['id' => new UuidValue(Uuid::uuid7())])->execute();

Verified locally against MySQL 8.4: the round-trip test inserts into a real binary(16) column and reads back 16 bytes that decode to the original UUID.

The branch name matches the one in yiisoft/db#1199, so install-packages resolves the core package from it and CI runs against the new class.

MySQL and MariaDB store a UUID as 16 raw bytes in a `binary(16)` column,
so `prepareValue()` converts the canonical form with
`DbUuidHelper::uuidToBlob()` and binds it as `DataType::LOB`.

Requires yiisoft/db#1199.
@codecov

codecov Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.10%. Comparing base (84ec3dd) to head (edf5530).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #482   +/-   ##
=========================================
  Coverage     99.10%   99.10%           
- Complexity      256      258    +2     
=========================================
  Files            24       25    +1     
  Lines           779      786    +7     
=========================================
+ Hits            772      779    +7     
  Misses            7        7           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/Builder/UuidValueBuilder.php Outdated
@KalimeroMK

Copy link
Copy Markdown
Contributor Author

These composer-dependency-analyser failures aren't from this PR's code — Yiisoft\Db\Expression\Value\UuidValue and its builder don't exist in any released yiisoft/db yet, they arrive with yiisoft/db#1199. The same five failures are on the other two driver PRs.

The other workflows don't hit it because they install the core from the PR branch: static.yml, rector-cs.yml, build.yml and mutation.yml pass required-packages: ['db'] to the reusable workflow, while composer-dependency-analyser.yml passes only php.

It clears itself once #1199 is merged and 2.0.2 is tagged. If you'd rather see it green before that, adding required-packages: ['db'] there is three lines and I can send it separately. Your call.

zoranbogoevskimkd and others added 2 commits September 13, 2026 07:46
The core UuidValueBuilder is final now, so this builder no longer extends
it. Dropping the inheritance keeps the coupling with the core package at
the interface.
Comment thread src/Builder/UuidValueBuilder.php Outdated
@Tigrov
Tigrov merged commit 6278a56 into yiisoft:master Sep 14, 2026
33 checks passed
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

Successfully merging this pull request may close these issues.

4 participants