Core Schema Adjustment - ID Data type from text to UUID
Hey guys I really can't find any way to fix this. I want to change ID data type from text to UUID but there is no option for this.
I use nextjs + postgres + kysely
Any ideas?
6 Replies
Related: https://discord.com/channels/1288403910284935179/1351917479089410108/1351917479089410108
There isn't a way yet, but with the idea to allow configuration of the
id
field name, we can probably consider the data type as well.Thanks for info! I'll donate some bucks, you guys are doing great work!
Also better-auth-kit looks promising, looking forward to that.
Thanks so much! ❤️
Is there any reason why it uses the text datatype with a self-gerenated ID,
instead of just (in the case of postgresql) using the database's built-in UUID-datatype and its built-in auto-generation
uuid("id").defaultRandom()
? Does the current approach have any benefits? Just wondering..The current
id
system is not very well-rounded. There are a lot of things which we definitely want to improve. Things such as using numeric values for IDs or allowing candidate keys over primary keys and other things too.
I assume that @bekacru wasn't aware of uuid
data type for id
s in PG. Since the schema generation code specifically for PG would likely come from our Kysely adapter, which meant that we needed to support multiple different databases to generate schemas, with that it was likely hard to keep in mind all of the different data-types possible for each database for schema generation.
If Bekacru approves, then we can support uuid
for PG in the future 👀you can change the type directly when you need it. The CLI is mostly meant to support the happy path.
That said as Ping mentioned we're revaming how
id
and primary keys work in the library