I love to work with WeWeb and Supabase.
I created a table in Supabase, which “created_at” column is set “not null”,and “default NOW()”. It isn’t need to be updated.
When I create workflow in WeWeb, do Upsert with Supabase plugin, and unselect “created_at” field. Creating new row works fine.
But when I test updating existing row, this action failed, with message:
Failed
Error: null value in column “created_at” of relation “qa_question” violates not-null constraint
I think it is strange, or am I strange. Please check it?
Hey,
this is the console log, saying that created_at have a not null constraint.
If you indeed have set it to be allowed to be null on the qa_question table, then the problem may be that we are sending a null parameter.
To see this, you can open the Network tab on the dev tools, and take a look at the api call to supabase that is receiving an error, and check what has been the request.
(Here an example with a request to create a tournament)
I’m trying to update an existing row, already filled created_at field. In this case, should I change this column to allow null?
Or I should set created_at field same to before updated.
I think you can’t pass null as ID. Just don’t pass the id at all. Or you’ll need to make a function trigger, that adds the ID before running the upsert. Also, if the ID is your PK, something might be wrong, because you should get that it violates non null constraint.
Really depends on the size of the operation. I think that for a few records, if it simplifies you the life, it’s okay Upserts are a quick way of doing things, but you’re right, not the most efficient