View | Details | Raw Unified | Return to bug 15675
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_15334.sql (-1 / +7 lines)
Line 1 Link Here
1
-- Add issue_id to accountlines table
1
ALTER TABLE accountlines ADD issue_id INT(11) NULL DEFAULT NULL AFTER accountlines_id;
2
ALTER TABLE accountlines ADD issue_id INT(11) NULL DEFAULT NULL AFTER accountlines_id;
2
- 
3
4
-- Close out any unclosed fines, keep only the latest fine unclosed
5
UPDATE accountlines SET accounttype = 'F' WHERE accountlines_id NOT IN ( SELECT accountlines_id FROM ( SELECT * FROM accountlines WHERE accounttype = 'FU' ORDER BY accountlines_id DESC ) a2 GROUP BY borrowernumber, itemnumber );
6
7
-- Update the unclosed fines to add the current issue_id to them
8
UPDATE accountlines LEFT JOIN issues USING ( itemnumber ) SET accountlines.issue_id = issues.issue_id WHERE accounttype = 'FU';

Return to bug 15675