Bug 9030

Summary: There is no constraint on aqorders_items
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: AcquisitionsAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: enhancement    
Priority: P5 - low CC: jcamins, kyle, m.de.rooy
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 9030: Add constraint on aqorders_items.ordernumber
[SIGNED-OFF] Bug 9030: Add constraint on aqorders_items.ordernumber
Rebased patch

Description Jonathan Druart 2012-11-08 12:48:45 UTC
When an order is deleted, the aqorders_items table is not affected.
Comment 1 Jonathan Druart 2012-11-08 12:55:05 UTC Comment hidden (obsolete)
Comment 2 Kyle M Hall 2012-11-09 15:15:25 UTC Comment hidden (obsolete)
Comment 3 Kyle M Hall 2012-11-09 15:16:12 UTC
Tested, cruft removed and constraint added.
Comment 4 Marcel de Rooy 2012-11-21 15:36:29 UTC
Created attachment 13595 [details] [review]
Rebased patch

Trivial rebase for updatedatabase
Comment 5 Marcel de Rooy 2012-11-21 15:37:59 UTC
(In reply to comment #3)
> Tested, cruft removed and constraint added.
Kyle: Apparently you forgot to update the status to Signed off.
Comment 6 Marcel de Rooy 2012-11-21 15:40:03 UTC
QA Comment: Looks good to me. Tested dbrev on upgrade. No complaints from qa-tools.
Passed QA
Comment 7 Jared Camins-Esakov 2012-11-25 23:49:25 UTC
Could you please explain how I would test that this constraint is doing what is desired?
Comment 8 Jonathan Druart 2012-11-26 09:36:20 UTC
(In reply to comment #7)
> Could you please explain how I would test that this constraint is doing what
> is desired?

For the Bug 8991, I developped a script to delete old orders. By "delete" I mean delete a record in DB.
If we delete an order in DB, we want to delete its related items too.
So for testing you can create an order with X items and execute a DELETE query from the aqorders table on this order.
The related items have to be deleted in cascade.
Comment 9 Jared Camins-Esakov 2012-11-28 23:50:25 UTC
This patch has been pushed to master.