Comments (11)
Thanks @driesvints. I was thinking about "only" switching the HasUuids
trait to UUID v7 while leaving Str::uuid()
unchanged. This would improve performance (at least with the DBMS we've checked so far) but not introduce any data leaks.
When upgrading to Laravel 12, existing users of the HasUuids
trait that rely on the sortability would have to override newUniqueId()
and continue using Str::orderedUuid()
to avoid the breaking change.
from framework.
Thanks for the PR @Karem-sobhy. IMO, the HasV7Uuid
trait is the best solution to the MariaDB issue right now.
For Laravel 12, I think we should consider again to switch to UUID v7
by default. Just last week, there was a tweet about the performance gains from v7
on PostgreSQL.
@driesvints Do you remember why #44210 got reverted in the end?
from framework.
@staudenmeir exactly what I was thinking about when creating the PR we leave Str::Uuid
as is and have Str:Uuid7
instead but like you i think that HasUuid
trait should use uuid7
by default because that if uuid7
leaks date so ordered uuid4
leaks the same data and is not a standard uuid also.
from framework.
Thanks @Karem-sobhy. Pinging you @staudenmeir as you were the author of #50192. Seems UUID columns aren't compatible with Laravel? I think we'll need more extensive tests in our MariaDB test suite for this one.
from framework.
Thank you for reporting this issue!
As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.
If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.
Thank you!
from framework.
Interesting issue. I don't order by UUID columns in my apps and so haven't run into it.
This issue makes the new UUID data type in MariaDB useless and not compatible with Laravel.
Not a very constructive statement. The issue is not that Laravel supports a native database data type. When you don't need your UUIDs to be sortable or already use v7
UUIDs, the native type is a great benefit. MariaDB added the type for a reason.
IMO, the best solution would be using v7
UUIDs instead the current of the v4
ordered UUIDs, but altering the HasUuids
trait's default behavior is basically an unsolvable breaking change.
Instead, I would say that this needs to be addressed by MariaDB users in their applications:
- We add a helper method for generating
v7
UUIDs and explain in the documentation that users should overridenewUniqueId()
in their models and generatev7
UUIDs. - Or we recommend to use
$table->char('uuid', 36);
columns when records need to be sortable.
from framework.
Thanks @staudenmeir. I do feel we need some documentation around this and would be grateful if anyone could provide a PR.
@Karem-sobhy please see @staudenmeir's reply around this topic.
from framework.
@staudenmeir using the old char(36) may be a fix but using the orderedUuid with mariadb is just bad for indexing and performance of the insertion and also non informed users maybe don't know all this because the documentation says clearly the uuid will be ordered which is not true when using mariadb default uuids
I can help with a pr but don't know what will be best action to do so can you help me to chose from:
- if the driver is mariadb then use v7 by default
- make another HasV7Uuid trait
- make new Str helper for v7 uuid and ask users to implement it in the newUniqueId method
@driesvints @staudenmeir I think you are more informed and can chose the best solution for this to implement it.
from framework.
I honestly don't know. We can't make the breaking change and having a HasV7Uuid
which should technically be the better default sits a bit ill with me. I just wouldn't change anything atm.
from framework.
Hey @staudenmeir. I guess it's mainly this remark from @tillkruss:
IMO it makes no sense to change the default Str::uuid() to v7, which will always reveal the timestamp (minor data leak),
Seems v7 has a data leak that's unwanted?
from framework.
@staudenmeir thanks for explaining. Right now I don't have the time to dig deeper into this matter. The best way forward is that you attempt a PR with whatever you want to try so Taylor can review it. Thanks 👍
from framework.
Related Issues (20)
- Weird Error Message When Internal Server Error. HOT 1
- RedirectIfAuthenticated::redirectUsing callback should get guard as a parameter
- RedirectIfAuthenticated::redirectUsing callback should get guard as a parameter HOT 1
- Listening on MigrationsEnded event stops seeders from running.
- Once function runs repeatedly if cached value is null HOT 5
- using php Named parameter in routes HOT 1
- Migrations are not published in timestamp order HOT 2
- Passing $attributes to component slot does not work HOT 4
- Inconsistent timestamps format for User model on Logout HOT 1
- LengthAwarePaginator returns the total provided regardless of the total actual count of the data HOT 2
- sessions table not pruning? HOT 7
- loadCount does not work when no relations exist HOT 5
- Factory-generated Carbon Object with Mutators Returns Incorrect Attribute Value Until Model is Refreshed HOT 1
- foreignId() function in Blueprint just work with bigInteger column
- Malformed URI "http://". ERROR In Request.php line 303 HOT 1
- Illuminate\Queue\Failed\FailedJobProviderInterface runs out of memory HOT 2
- `artisan schema:dump` includes internal `sqlite_*` tables in SQLite dumps, making them unusable
- artisan puts curl request in infinite loop HOT 1
- Sanctum does not seem to revoke tokens HOT 2
- IntlException Constructor failed HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from framework.