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
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?
Nope haven't tried that but if that's not officially supported then I guess the best is to avoid doing it!
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
Yes could work will give it a go thanks @ayman
you're welcome :)
This could be a feature request. You guys can add one to github