gen_random_uuid not working

hi. I am trying to use postgress db provisioned on railway with drizzle. my schema look like id: uuid('id').default(sql'gen_random_uuid()') but on insert into this db I get error PostgresError: null value in column "id" of relation "file" violates not-null constraint is it possible that my db does not have this function? if so what should I do to create column with autogenerated uuid ? thanks!
Solution:
you would first need to enable the pgcrypto extension, do that by running this query -
CREATE EXTENSION pgcrypto;
CREATE EXTENSION pgcrypto;
...
Jump to solution
3 Replies
Percy
Percy9mo ago
Project ID: 60fd5f13-1cb6-475b-81c4-4b1e7803c705
kiryl_ch
kiryl_chOP9mo ago
60fd5f13-1cb6-475b-81c4-4b1e7803c705
Solution
Brody
Brody9mo ago
you would first need to enable the pgcrypto extension, do that by running this query -
CREATE EXTENSION pgcrypto;
CREATE EXTENSION pgcrypto;
Want results from more Discord servers?
Add your server