[almighty] Gorm cannot recreate soft-deleted WorkItemTypes

Aslak Knutsen aslak at redhat.com
Wed Nov 16 10:49:41 UTC 2016


Delete the WorkItems and WorkItemTypes Unscoped?


-aslak-



On Wed, Nov 16, 2016 at 10:40 AM, Max Rydahl Andersen <manderse at redhat.com>
wrote:

> is this not an argument for using unique id's rather than business names
> as primary keys ?
>
> /max
>
>
> 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
>>
>>
>> _______________________________________________
>> almighty-public mailing list
>> almighty-public at redhat.com
>> https://www.redhat.com/mailman/listinfo/almighty-public
>>
>
>
> /max
> http://about.me/maxandersen
>
>
> _______________________________________________
> almighty-public mailing list
> almighty-public at redhat.com
> https://www.redhat.com/mailman/listinfo/almighty-public
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/almighty-public/attachments/20161116/ec9f22df/attachment.htm>


More information about the almighty-public mailing list