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

Use new column definition builder #329

Merged
merged 6 commits into from
Dec 23, 2024
Merged

Conversation

Tigrov
Copy link
Member

@Tigrov Tigrov commented Dec 1, 2024

Related PR

Q A
Is bugfix?
New feature? ✔️
Breaks BC? ✔️
Fixed issues

Copy link

codecov bot commented Dec 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.51%. Comparing base (aac0f56) to head (4d83461).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #329   +/-   ##
=========================================
  Coverage     98.51%   98.51%           
- Complexity      336      337    +1     
=========================================
  Files            23       23           
  Lines          1077     1079    +2     
=========================================
+ Hits           1061     1063    +2     
  Misses           16       16           

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

@@ -12,8 +12,7 @@ final class ColumnDefinitionBuilder extends AbstractColumnDefinitionBuilder
{
protected const AUTO_INCREMENT_KEYWORD = 'AUTOINCREMENT';

protected const GENERATE_UUID_EXPRESSION =
"(unhex(format('%016X', random() & 0xFFFFFFFFFFFF4FFF | 0x4000) || format('%016X', random() & 0xBFFFFFFFFFFFFFFF | 0xB000000000000000)))";
protected const GENERATE_UUID_EXPRESSION = '(randomblob(16))';

Copy link
Member

Choose a reason for hiding this comment

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

Is that v4 or v7? V7 is much preferred.

Copy link
Member Author

@Tigrov Tigrov Dec 11, 2024

Choose a reason for hiding this comment

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

It is not valid v4.
The previous valid v4 requires to update sqlite extension for php (unhex() requires new version of sqlite).

Copy link
Member

@samdark samdark left a comment

Choose a reason for hiding this comment

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

It is OK for now, but I'd add at least a guide on how to deal with UUIDv7 with every DB. Probably by generating it on PHP side...

@Tigrov
Copy link
Member Author

Tigrov commented Dec 13, 2024

It is OK for now, but I'd add at least a guide on how to deal with UUIDv7 with every DB. Probably by generating it on PHP side...

This is an expression for the default value when inserting a row without a specific uuid value.
Unfortunately, not all DBMS have built-in tools for generating the required uuid as a default value.

The user can use any library to generate uuid on PHP side. Perhaps we can suggest some of them or make simple versions inside db package.
Also plan to add a UuidColumn class to convert uuid values ​​to/from the database.

@Tigrov Tigrov merged commit f926994 into master Dec 23, 2024
18 checks passed
@Tigrov Tigrov deleted the use-new-column-definition-builder branch December 23, 2024 04:45
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.

3 participants