hello i created a new table with type uuid instead...
# off-topic
g
hello i created a new table with type uuid instead of int8 for id field. when i insert data in the table, it says
Error: null value in column "id" of relation "sessions" violates not-null constraint
. should i provide a uuid myself? i try to revert to int8 to benefit from auto increment, but it's stuck with uuid
s
You need to set the default value for that field to use the uuid generate function
uuid_generate_v4()
l
@User It took me a while to figure this out as well. As @User mentioned, in the Supabase UI, when you choose
uuid
type for your id field in the table settings, then you need to manually type
uuid_generate_v4()
into the
default value
field for id. After that, it should start working as expected. (Requires manually typing this in on my end at least).