You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make UUID default to UserUnfo table and Object #649
To be honest, I never myself whether the int id is an issue.
It'd definitely be easier to implement. But I'd prefer a ColumnUUID. 😆
Unfortunately this is a breaking change.
It might be best to give the modules versions independent of the main Serverpod version. Due to the way pub get resolves, it should be safe. @vlidholt What do you think about this?
I believe it should be configurable to the user's liking. Personally, I only use the gen_random_uuid () function in postgres to generate my IDs because it makes it easy for a possible migration to another database. So it would be interesting for the dev to choose how they want to generate the table's ID.
Serverpod should have a config option to use UUID instead of serial integer for the id field if the developer requires it, especially for distributed apps. Somehow there could be a huge warning that changing this option would totally break their database. You could have it as a config flag i.e. --uuid in the serverpod CLI. It would be complicated to implement, but worth it.
@yahu1031 - Am I correct I interpret this issue as using UUIDs for all id fields instead of the current int id solution?
That would also differentiate it from #554, that focuses more on ensuring that ids are not guessable.
@SandPod, I also have a distributed use case where using UUIDs instead of int as ID on all tables would be necessary. I'm building an offline-first app that will have upserts from multiple clients in several related tables. Although it is possible to use secondary UUID columns with unique indexes, the relation on the server would still be on the int ID and require several round-trips to solve updates on the relations. Not to mention the wasted disk space by having two ID columns everywhere when only one will be used on the queries.
Is there any plan to implement such feature in the next releases? I'd gladly contribute with a PR if possible.
@marcelomendoncasoares - We are working on an updated Roadmap for the spring during the week. Hopefully I can give a better update next week around what will be prioritized by the Serverpod team.
If this does not make the cut and you are up for it, we could do some investigation to try and detail the issue a bit more to see if you could take it on.
@SandPod, I hope I didn't get too much ahead of myself on this, but I may have already implemented it. As this is a requirement for my use case, I unfortunately could not afford to wait. So I was faced with the difficult decision to either take a shot at the implementation or abandon serverpod (which I didn't want at all).
I'm just finishing some last touches on the branch and adding a few more tests, but it is already passing on all existing tests (and several ones I added). So, if it is not a problem, I can open a PR describing all changes in detail and you can point me to the direction that the team envisions for this feature. Does it work?
@marcelomendoncasoares - That would be great! The feature in itself is pretty self explanatory. The main consideration here is that the solution fits the rest of the framework and vision.
The reason you have not received a review on the PRs you have open already is because we are working on the planning for the year. I'll get back on top of these during next week.
Reacted by Marcelo Mendonça Soares and Bin Emmanuel
Activity
fischerscode commentedon Feb 12, 2023
To be honest, I never myself whether the
intid is an issue.It'd definitely be easier to implement. But I'd prefer a
ColumnUUID. 😆Unfortunately this is a breaking change.
It might be best to give the modules versions independent of the main Serverpod version. Due to the way
pub getresolves, it should be safe.@vlidholt What do you think about this?
yahu1031 commentedon Feb 12, 2023
Yes it is a breaking change but not for
2.*, can go to1.*vlidholt commentedon Feb 13, 2023
All breaking changes are saved for 2.x, unless there is a security issue.
glourencosilva commentedon Feb 13, 2023
I believe it should be configurable to the user's liking. Personally, I only use the gen_random_uuid () function in postgres to generate my IDs because it makes it easy for a possible migration to another database. So it would be interesting for the dev to choose how they want to generate the table's ID.
https://www.postgresql.org/docs/current/functions-uuid.html
fischerscode commentedon Feb 13, 2023
Might be related to #236. Or at least defaults might be a solution.
tgrushka commentedon Sep 29, 2023
Serverpod should have a config option to use UUID instead of serial integer for the
idfield if the developer requires it, especially for distributed apps. Somehow there could be a huge warning that changing this option would totally break their database. You could have it as a config flag i.e.--uuidin the serverpod CLI. It would be complicated to implement, but worth it.SandPod commentedon Dec 17, 2024
@yahu1031 - Am I correct I interpret this issue as using UUIDs for all id fields instead of the current int id solution?
That would also differentiate it from #554, that focuses more on ensuring that ids are not guessable.
yahu1031 commentedon Dec 18, 2024
@SandPod Yeah, actually this is a kind of sub/related to that issue.
marcelomendoncasoares commentedon Jan 4, 2025
@SandPod, I also have a distributed use case where using UUIDs instead of int as ID on all tables would be necessary. I'm building an offline-first app that will have upserts from multiple clients in several related tables. Although it is possible to use secondary UUID columns with unique indexes, the relation on the server would still be on the int ID and require several round-trips to solve updates on the relations. Not to mention the wasted disk space by having two ID columns everywhere when only one will be used on the queries.
Is there any plan to implement such feature in the next releases? I'd gladly contribute with a PR if possible.
Jaaco commentedon Jan 4, 2025
I'm building the same exact thing and faced the same problem. Thanks for typing it out @marcelomendoncasoares :D
SandPod commentedon Jan 7, 2025
@marcelomendoncasoares - We are working on an updated Roadmap for the spring during the week. Hopefully I can give a better update next week around what will be prioritized by the Serverpod team.
If this does not make the cut and you are up for it, we could do some investigation to try and detail the issue a bit more to see if you could take it on.
marcelomendoncasoares commentedon Jan 10, 2025
@SandPod, I hope I didn't get too much ahead of myself on this, but I may have already implemented it. As this is a requirement for my use case, I unfortunately could not afford to wait. So I was faced with the difficult decision to either take a shot at the implementation or abandon serverpod (which I didn't want at all).
I'm just finishing some last touches on the branch and adding a few more tests, but it is already passing on all existing tests (and several ones I added). So, if it is not a problem, I can open a PR describing all changes in detail and you can point me to the direction that the team envisions for this feature. Does it work?
SandPod commentedon Jan 10, 2025
@marcelomendoncasoares - That would be great! The feature in itself is pretty self explanatory. The main consideration here is that the solution fits the rest of the framework and vision.
The reason you have not received a review on the PRs you have open already is because we are working on the planning for the year. I'll get back on top of these during next week.
SandPod commentedon Feb 28, 2025
The work for adding UUID as primary key type to the framework is tracked here: #3255
marcelomendoncasoares commentedon Apr 3, 2026
Closing as completed, since we use UUID as PK for the user on the new auth.