[almighty] Gorm cannot recreate soft-deleted WorkItemTypes
Thomas Mäder
tmader at redhat.com
Wed Nov 16 10:34:37 UTC 2016
Hi Folks,
I have just come across the issue
https://github.com/jinzhu/gorm/issues/759 when trying to create and
delete work item types for a test. The gist is: gorm can't recreate
objects that have been soft-deleted. Using "Unscoped()" does not work in
this instance, since the soft-deleted work items remain in in the
database and have a dangling foreign key to the work item types. The bug
has been close, so I don't think there will be a fix for it. I'm writing
this because I want people to be aware of the issue.
For our concrete example, I am going to follow one of the suggestions
from the bug:
> 1, Use ThreadName & DeletedAt as combined unique index
When "DeletedAt" is nil, it becomes the same uniqueness condition as we
have now. The FK on work_items will have to be fixed, as well.
/Thomas
More information about the almighty-public
mailing list