<div dir="ltr"><div>Delete the WorkItems and WorkItemTypes Unscoped?</div><div><br></div><div><br></div><div>-aslak-</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 16, 2016 at 10:40 AM, Max Rydahl Andersen <span dir="ltr"><<a href="mailto:manderse@redhat.com" target="_blank">manderse@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">is this not an argument for using unique id's rather than business names as primary keys ?<br>
<br>
/max<div><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Folks,<br>
<br>
I have just come across the issue <a href="https://github.com/jinzhu/gorm/issues/759" rel="noreferrer" target="_blank">https://github.com/jinzhu/gorm<wbr>/issues/759</a> 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.<br>
For our concrete example, I am going to follow one of the suggestions from the bug:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
1, Use ThreadName & DeletedAt as combined unique index<br>
</blockquote>
<br>
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.<br>
<br>
/Thomas<br>
<br>
<br>
______________________________<wbr>_________________<br>
almighty-public mailing list<br>
<a href="mailto:almighty-public@redhat.com" target="_blank">almighty-public@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/almighty-public" rel="noreferrer" target="_blank">https://www.redhat.com/mailman<wbr>/listinfo/almighty-public</a><br>
</blockquote>
<br>
<br></div></div>
/max<br>
<a href="http://about.me/maxandersen" rel="noreferrer" target="_blank">http://about.me/maxandersen</a><div class="HOEnZb"><div class="h5"><br>
<br>
______________________________<wbr>_________________<br>
almighty-public mailing list<br>
<a href="mailto:almighty-public@redhat.com" target="_blank">almighty-public@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/almighty-public" rel="noreferrer" target="_blank">https://www.redhat.com/mailman<wbr>/listinfo/almighty-public</a><br>
</div></div></blockquote></div><br></div>