Create unique slugs with $defaultFn

Hi there, Just wanted to know if it was possible to create unique slugs for every user using $defaultFn. My slugs are generated based on another field's value and must be unique. Using defaultFn, can I access the tables current values?
6 Replies
aymeric
aymeric13mo ago
I don't think $defaultFn is passing any arguments to achieve this. Would be a great feature. Have you tried ignoring type errors to see what it does?
No description
LeFuncq
LeFuncqOP13mo ago
Nope haven't tried that but if that's not officially supported then I guess the best is to avoid doing it!
icarus
icarus13mo ago
i've also been looking into doing something like that recently, i think the best approach that'd work for you with how drizzle is currently is to create a trigger in the database layer, and have it fill your generated column on every insert
LeFuncq
LeFuncqOP13mo ago
Yes could work will give it a go thanks @ayman
icarus
icarus13mo ago
you're welcome :)
Angelelz
Angelelz13mo ago
This could be a feature request. You guys can add one to github
Want results from more Discord servers?
Add your server