Skip to content

Make UUID default to UserUnfo table and Object #649

Closed

Description

@yahu1031

Feature request description

@fischerscode Instead making uuid optional for the user's custom DB. Also, we can add UUID as a default ColumnString in the user_info table.

NOTE: This may need a whole table to alter if any DB/Server is in production. Lemme know your thoughts.

Activity

  1. fischerscode commented on Feb 12, 2023

    @fischerscode
    Contributor

    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?

  2. yahu1031 commented on Feb 12, 2023

    @yahu1031
    ContributorAuthor

    Yes it is a breaking change but not for 2.*, can go to 1.*

  3. vlidholt commented on Feb 13, 2023

    @vlidholt
    Collaborator

    All breaking changes are saved for 2.x, unless there is a security issue.

  4. added
    discussion
    on Feb 13, 2023
  5. glourencosilva commented on Feb 13, 2023

    @glourencosilva

    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

  6. fischerscode commented on Feb 13, 2023

    @fischerscode
    Contributor

    So it would be interesting for the dev to choose how they want to generate the table's ID.

    Might be related to #236. Or at least defaults might be a solution.

  7. tgrushka commented on Sep 29, 2023

    @tgrushka
    Contributor

    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.

  8. SandPod commented on Dec 17, 2024

    @SandPod
    Contributor

    @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.

  9. added
    area: authentication
    enhancement
    and removed
    discussion
    on Dec 17, 2024
  10. yahu1031 commented on Dec 18, 2024

    @yahu1031
    ContributorAuthor

    @SandPod Yeah, actually this is a kind of sub/related to that issue.

  11. marcelomendoncasoares commented on Jan 4, 2025

    @marcelomendoncasoares
    Collaborator

    @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.

  12. Jaaco commented on Jan 4, 2025

    @Jaaco

    I'm building the same exact thing and faced the same problem. Thanks for typing it out @marcelomendoncasoares :D

  13. SandPod commented on Jan 7, 2025

    @SandPod
    Contributor

    @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.

  14. marcelomendoncasoares commented on Jan 10, 2025

    @marcelomendoncasoares
    Collaborator

    @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?

  15. SandPod commented on Jan 10, 2025

    @SandPod
    Contributor

    @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.

  16. moved this from Now 🔥 to Next 🌟 in Serverpod Frameworkson Feb 28, 2025
  17. SandPod commented on Feb 28, 2025

    @SandPod
    Contributor

    The work for adding UUID as primary key type to the framework is tracked here: #3255

  18. moved this from Next 🌟 to No status in Serverpod Frameworkson Feb 28, 2025
  19. marcelomendoncasoares commented on Apr 3, 2026

    @marcelomendoncasoares
    Collaborator

    Closing as completed, since we use UUID as PK for the user on the new auth.

  20. moved this from Backlog 🗂️ to Done 🚀 in Serverpod Frameworkson Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: authenticationenhancement

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions