#Unable to delete workspace if records have an attachment

1 messages · Page 1 of 1 (latest)

solar elbow
#

Error received:
null value in column "authorId" of relation "attachment" violates not-null constraint

How to fix?

grand crescent
#

Hello @solar elbow, what version of twenty are you running ? ( If you're on the latest please describe how you inserted an attachement that has no authorId, such as through api ? )

To address your issue go in database and find null authotId row and delete it manually then you should be able to delete the workspace

( Ps screenshot is weirdly cropped)

solar elbow
#

But all my rows have authorId in them. I use the API

#

Running twenty .42

#

After I remove all the attachments, I can delete the workspace

solar elbow
#

So intriguing

grand crescent
#

Mhm there might be a bug when deleting a workspace containing attachements, would you be able to reproduce by creating a workspace with an attachement and delete it ? Will attempt to do so on the latest 0.43

solar elbow
#

Were you able to reproduce?

restive oar
solar elbow
#

Yes that’s right

solar elbow
#

fixed by adding await workspaceDataSource?.query(
DELETE FROM ${dataSourceMetadata.schema}."attachment",
);

in the deleteUserFromWorkspace function

#

Then it deletes smoothly