Replies: 1 comment
-
int (autoincrement) vs uuid(not timestamp based one) has an order, it is also faster when sorting. PS. if you change a PK, you need to change all foreign keys for it in all over the places. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am using a fresh installation of Laravel 11 for a new project of mine.
What I wanted to do first is change the default auto-incrementing id on the users table to either UUID or ULID.
The default migrations look like this:
https://github.com/laravel/laravel/blob/11.x/database/migrations/0001_01_01_000000_create_users_table.php
So change the migration from:
To:
Now I noticed that the
sessions
table also uses UUIDs, but it's done by:And for the jobs migrations:
https://github.com/laravel/laravel/blob/11.x/database/migrations/0001_01_01_000002_create_jobs_table.php
Now I would make a pull request for this changing this, but before I do, I wanted to know if there's a specific reason why by default the migrations dont all use
Instead of a combination of the following 2:
Isn't UUID already pretty much unique ? So why is that defined on that column.
It doesn't really feel streamlined that way I feel like.
Now for myself I change everything to the
uuid('id')
, and removed the extra incrementing id from thefailed_jobs table
, but I don't know if this will cause issues later on the road.Beta Was this translation helpful? Give feedback.
All reactions