[codeface] [PATCH 02/10] Unify issue_dependencies and issue_duplicates DB tables

  • From: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxxxxxxxx>
  • To: <codeface@xxxxxxxxxxxxx>
  • Date: Thu, 1 Dec 2016 08:13:01 +0100

From: Petr Pícha <ppicha@xxxxxxxxxxx>

Tables issue_depedencies and issue_duplicates describe different
types of relations between two issues. In issue-tracking tools
other than bugzilla, there are more options for issue relation types.
Merge the tables into a single table issue_relations, and add an
attribute "relation" (type in string form) to model different types
of relations between issues in a unified way. The intended format is

            <leftIssueId> <relation> <rightIssueId>

(e.g., "96 duplicates 15").

Signed-off-by: Petr Pícha <ppicha@xxxxxxxxxxx>
Signed-off-by: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxxxxxxxx>
---
 datamodel/codeface.mwb        | Bin 60510 -> 59828 bytes
 datamodel/codeface_schema.sql |  52 +++++++++++-------------------------------
 2 files changed, 13 insertions(+), 39 deletions(-)

diff --git a/datamodel/codeface.mwb b/datamodel/codeface.mwb
index bd5c01f..2058f0c 100644
Binary files a/datamodel/codeface.mwb and b/datamodel/codeface.mwb differ
diff --git a/datamodel/codeface_schema.sql b/datamodel/codeface_schema.sql
index d32a139..61f43e7 100644
--- a/datamodel/codeface_schema.sql
+++ b/datamodel/codeface_schema.sql
@@ -1,5 +1,5 @@
 -- MySQL Script generated by MySQL Workbench
--- 11/28/16 15:52:22
+-- 11/28/16 16:00:53
 -- Model: New Model    Version: 1.0
 -- MySQL Workbench Forward Engineering
 
@@ -409,57 +409,31 @@ CREATE INDEX `commitcom_person_idx` ON 
`codeface`.`commit_communication` (`who`
 
 
 -- -----------------------------------------------------
--- Table `codeface`.`issue_duplicates`
+-- Table `codeface`.`issue_relations`
 -- -----------------------------------------------------
-DROP TABLE IF EXISTS `codeface`.`issue_duplicates` ;
+DROP TABLE IF EXISTS `codeface`.`issue_relations` ;
 
-CREATE TABLE IF NOT EXISTS `codeface`.`issue_duplicates` (
+CREATE TABLE IF NOT EXISTS `codeface`.`issue_relations` (
   `id` BIGINT NOT NULL AUTO_INCREMENT,
-  `originalBugId` BIGINT NOT NULL,
-  `duplicateBugId` BIGINT NOT NULL,
+  `leftIssueId` BIGINT NOT NULL,
+  `relation` VARCHAR(45) NOT NULL,
+  `rightIssueId` BIGINT NOT NULL,
   PRIMARY KEY (`id`),
-  CONSTRAINT `original_issue_duplicate`
-    FOREIGN KEY (`originalBugId`)
+  CONSTRAINT `left_issue_relation`
+    FOREIGN KEY (`leftIssueId`)
     REFERENCES `codeface`.`issue` (`id`)
     ON DELETE CASCADE
     ON UPDATE CASCADE,
-  CONSTRAINT `duplicate_issue_duplicate`
-    FOREIGN KEY (`duplicateBugId`)
+  CONSTRAINT `right_issue_relation`
+    FOREIGN KEY (`rightIssueId`)
     REFERENCES `codeface`.`issue` (`id`)
     ON DELETE CASCADE
     ON UPDATE CASCADE)
 ENGINE = InnoDB;
 
-CREATE INDEX `original_issue_duplicate_idx` ON `codeface`.`issue_duplicates` 
(`originalBugId` ASC);
+CREATE INDEX `left_issue_relation_idx` ON `codeface`.`issue_relations` 
(`leftIssueId` ASC);
 
-CREATE INDEX `duplicate_issue_duplicate_idx` ON `codeface`.`issue_duplicates` 
(`duplicateBugId` ASC);
-
-
--- -----------------------------------------------------
--- Table `codeface`.`issue_dependencies`
--- -----------------------------------------------------
-DROP TABLE IF EXISTS `codeface`.`issue_dependencies` ;
-
-CREATE TABLE IF NOT EXISTS `codeface`.`issue_dependencies` (
-  `id` BIGINT NOT NULL AUTO_INCREMENT,
-  `originalIssueId` BIGINT NOT NULL,
-  `dependentIssueId` BIGINT NOT NULL,
-  PRIMARY KEY (`id`),
-  CONSTRAINT `dependent_original_issue`
-    FOREIGN KEY (`originalIssueId`)
-    REFERENCES `codeface`.`issue` (`id`)
-    ON DELETE CASCADE
-    ON UPDATE CASCADE,
-  CONSTRAINT `dependent_dependent_issue`
-    FOREIGN KEY (`dependentIssueId`)
-    REFERENCES `codeface`.`issue` (`id`)
-    ON DELETE CASCADE
-    ON UPDATE CASCADE)
-ENGINE = InnoDB;
-
-CREATE INDEX `dependent_original_issue_idx` ON `codeface`.`issue_dependencies` 
(`originalIssueId` ASC);
-
-CREATE INDEX `dependent_dependent_issue_idx` ON 
`codeface`.`issue_dependencies` (`dependentIssueId` ASC);
+CREATE INDEX `right_issue_relation_idx` ON `codeface`.`issue_relations` 
(`rightIssueId` ASC);
 
 
 -- -----------------------------------------------------
-- 
2.8.3


Other related posts:

  • » [codeface] [PATCH 02/10] Unify issue_dependencies and issue_duplicates DB tables - Wolfgang Mauerer