Planetscale UUID
Can anybody suggest how to use uuid as primary key in planetscale with drizzle orm?
23 Replies
You have to generate the uuid yourself
Also should I use uuid or serial key that's also a question for me
i dont recomend using uuids
they arent sortable in the same way that they were created
cuid2 or ulid
are two nice alternatives
main difference that i can remember is: storage and limit
storing string ids are more expensive in terms of storage, but they dont suffer from limitations of length
a
int
id column tops are 4294967295
if you have the scale to worry about topping a column and not wanting to have to deal with changing the schema later, go with string ids
if not, just use what you wantActually I was also thinking of going with string ids but was finding a way to auto implment string ids in drizzle I guess I need to do that manually
you can probably use a default of calling a mysql function
is there one for mysql for cuid?
cuid probably not
uuid probably there is one
okk then it would be great using an uuid
check if the mysql server has a generate uuid function
Postgres > MySQL
Actually I found PlanetScale to be a nice service but uses mysql behind the scenes. Also Neon has got its own limitations, can you recoomed some hosted service for postgresql?
This one we can try out
I came here to check to see if this question was moved into here and answered. Awesome to see both happened!
Supabase is probably the best postgres hosted service with good DX
I like neon too
if you want a compatible
cba with anything mysql
cockroachdb as well
Neon is good, there is a reason Vercel chose it lol
I guess moving to Postgresql is kinda the right way.
As I was unable to find any direct way in mysql.
Thanks guys for the help. It really means a lot to me.
glad to help
Btw one last thing what would you suggest to use Neon or Supabase?
neon
Okk will go with that👍👍