supabase / supautils

PostgreSQL extension that secures a cluster on a cloud environment

Home Page:https://supabase.github.io/supautils

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ability to generate CUID an alternative to UUID via Official Extension Support

sandbox-apps opened this issue · comments

Feature request

Right now my project is in prisma and nestjs, Now one feature of prisma was ability to autogenerate CUID().
I use cuid() for all my primary keys. I heavily invested on cuid because of its advantage over uuid.
Right now there is an available snippet in github to create a cuid extension. But I only trust and only love to use a official support of supabase.

CUID has a several benefits compare to Auto Incremented IDs and UUID. One of the benefits is

Collision-resistant ids optimized for horizontal scaling and binary search lookup performance.
We can look more here at https://github.com/ericelliott/cuid

Hey @sandbox-apps - it looks interesting. I'll move this over to our supautils repo for investigation. If we decide to add it, it should probably be inside an extension and we can use supautils for this.

Note that it's probably not going to happen soon (unless one of the community pick it up), as we're focused mostly on stability for the next few months

pg_idkit would cover this as already requested:
supabase/postgres#318
supabase/supabase#9333
supabase/supabase#9500
tweet
and already showcased in Choosing a Postgres Primary Key

unfortunately according to this reddit comment the extension might not yet meet the Supabase's requirements to be included