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
Ping
Ping2mo ago
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.
marekuss
marekussOP2mo ago
Thanks for info! I'll donate some bucks, you guys are doing great work! Also better-auth-kit looks promising, looking forward to that.
Ping
Ping2mo ago
Thanks so much! ❤️
Flo
Flo4w ago
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..
Ping
Ping4w ago
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 ids 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 👀
bekacru
bekacru4w ago
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

Did you find this page helpful?