Skip to content

Commit

Permalink
[issue_tracker - raisinbread/tools] Fix issue tracker history wrong m…
Browse files Browse the repository at this point in the history
…odule ID (#8677)

This single use tool https://github.com/aces/Loris/blob/main/tools/single_use/Convert_LorisMenuID_to_ModuleID.php failed to convert the now deprecated LorisMenuID to the current modules table ModuleID for rows in issues_history table. The histories now refer to old LorisMenuIDs which map to the wrong module in the new modules table. This fixes this discrepancy by providing a patch, fixing the raisinbread dataset , and updating the conversion tool.

How this should be used for existing projects:

- If project upgraded to 23.0 and so already ran the Convert_LorisMenuID_to_ModuleID.php script, the project should run the patch SQL/New_patches/2023-04-25-FixIssueWrongModuleID.sql
  • Loading branch information
zaliqarosli committed Jan 11, 2024
1 parent 18707d1 commit 32ef64d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 8 additions & 0 deletions SQL/New_patches/2023-04-25-FixIssueWrongModuleID.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- NOTE: This SQL patch follows up the running of single use tool `tools/single_use/Convert_LorisMenuID_to_ModuleID.php`
-- that was necessary to upgrade the `issues` table from LORIS version 22 to version 23. The tool forgot
-- to include an upgrade of the `issues_history` table, which is now tackled by this SQL patch.

-- delete from issues_history any orphaned module IDs
DELETE FROM issues_history WHERE fieldChanged='module' AND issueID IN (SELECT issueID FROM issues WHERE module IS NULL);
-- set issues history module ID to correct moduleID, replacing old LorisMenu ID
UPDATE issues_history ih SET newValue=(SELECT i.module FROM issues i WHERE i.issueID=ih.issueID) WHERE fieldChanged='module';
9 changes: 4 additions & 5 deletions raisinbread/RB_files/RB_issues_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldC
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (19,'admin','2016-09-02 20:30:38','assignee',16,'tester');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (20,'new issue to test assignee notification','2016-09-02 20:30:38','title',16,'tester');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (21,'Examiners','2016-09-02 20:30:38','category',16,'tester');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (22,'21','2016-09-02 20:30:39','module',16,'tester');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (22,'16','2016-09-02 20:30:39','module',16,'tester');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (23,'tester','2016-09-02 20:30:39','comment',16,'tester');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (24,'2016-09-02 12:30:38','2016-09-02 20:30:39','comment',16,'tester');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (25,'tester','2016-09-02 20:31:45','assignee',17,'tester');
Expand All @@ -39,13 +39,12 @@ INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldC
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (36,'3','2016-09-02 21:59:56','centerID',19,'tester');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (37,'testing if assignee gets email - new ticket','2016-09-02 21:59:56','title',19,'tester');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (38,'Examiners','2016-09-02 21:59:56','category',19,'tester');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (39,'11','2016-09-02 21:59:56','module',19,'tester');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (39,'17','2016-09-02 21:59:56','module',19,'tester');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (40,'tester','2016-09-02 22:02:29','assignee',20,'tester');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (41,'feedback','2016-09-02 22:02:29','status',20,'tester');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (42,'urgent','2016-09-02 22:02:30','priority',20,'tester');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (43,'testing if assignee gets email upon ticket update+re-assign','2016-09-02 22:02:30','title',20,'tester');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (44,'Imaging','2016-09-02 22:02:30','category',20,'tester');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (45,'12','2016-09-02 22:02:30','module',20,'tester');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (46,'admin','2016-09-02 22:04:38','assignee',20,'tester');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (47,'tester','2016-09-02 23:45:40','assignee',21,'tester');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (48,'ticket to end all tickets ','2016-09-02 23:45:40','title',21,'tester');
Expand All @@ -62,12 +61,12 @@ INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldC
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (59,'2','2016-09-07 01:19:21','centerID',26,'admin');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (60,'testing site population','2016-09-07 01:19:21','title',26,'admin');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (61,'Behavioural Battery','2016-09-07 01:19:21','category',26,'admin');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (62,'11','2016-09-07 01:19:21','module',26,'admin');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (62,'17','2016-09-07 01:19:21','module',26,'admin');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (63,'test','2016-09-07 01:38:06','assignee',27,'admin');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (64,'3','2016-09-07 01:38:06','centerID',27,'admin');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (65,'test ticket with visit label','2016-09-07 01:38:06','title',27,'admin');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (66,'Behavioural Instruments','2016-09-07 01:38:06','category',27,'admin');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (67,'10','2016-09-07 01:38:07','module',27,'admin');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (67,'9','2016-09-07 01:38:07','module',27,'admin');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (68,'300002','2016-09-07 01:38:07','comment',27,'admin');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (69,'2','2016-09-07 01:39:23','sessionID',27,'admin');
INSERT INTO `issues_history` (`issueHistoryID`, `newValue`, `dateAdded`, `fieldChanged`, `issueID`, `addedBy`) VALUES (70,'2','2016-09-07 02:19:59','sessionID',27,'admin');
Expand Down

0 comments on commit 32ef64d

Please sign in to comment.