hold request selection_ou needs fkey

Bug #2011434 reported by Rogan Hamby
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Committed
Wishlist
Unassigned

Bug Description

The selection_ou should have an fkey back to actor.org_unit as the other three references in the table do.

Revision history for this message
Rogan Hamby (rogan-hamby) wrote :
Changed in evergreen:
importance: Undecided → Low
Michele Morgan (mmorgan)
tags: added: database pullrequest
Revision history for this message
Galen Charlton (gmc) wrote :

I've found at least one production database that has ahr.selection_ou values that are not present in the actor.org_unit table. (Possibly as a leftover from removal of an old OU).

Consequently, the upgrade script will need to do *something* to catch that case. Perhaps set selection_ou to request_lib?

Revision history for this message
Rogan Hamby (rogan-hamby) wrote :

Galen has a good point and I think that defaulting to request_lib is the safest bet. So I've pushed an update to update ahr selection_ou to request_lib when the selection_ou isn't in actor.org_unit

Changed in evergreen:
assignee: nobody → Jane Sandberg (sandbergja)
Changed in evergreen:
milestone: none → 3.12-beta
Revision history for this message
Jane Sandberg (sandbergja) wrote :

Thanks, Rogan, for identifying this and fixing it! I've made a few tweaks:

1. Squashing your commits
2. adding the lp number to the commit message
3. Using the NOT VALID / VALIDATE CONSTRAINT pattern to minimize locking on action.hold_request in the upgrade script.
4. Also in the upgrade script, simplifying (at least to my eye) the UPDATE query that adjusts invalid selection_ou -- although your version worked just fine as well, and I could be persuaded either way.

I chose to treat this as a new feature, with the reasoning that it is a new improvement to our database API. As such, with 3.11 frozen for new features, I merged it for inclusion in 3.12.

Changed in evergreen:
status: New → Fix Committed
importance: Low → Wishlist
tags: added: signedoff
Changed in evergreen:
assignee: Jane Sandberg (sandbergja) → nobody
Revision history for this message
Jane Sandberg (sandbergja) wrote :

umm, scratch number 2. Looks like I never actually added the lp number to the commit message. :-)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.