[codeface] [PATCH 05/10] Create a relationship between issues and commits in DB

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

From: Petr Pícha <ppicha@xxxxxxxxxxx>

Many issue-tracking and VCS tools allow for an issue to mention
(or have another connection to) multiple commits, and for a commit
to link to multiple issues. And even if not specifically stated
in the tools the pairings between commits and issues (attained, e.g.,
by analysis) are useful for further analyses. Create a table in
the database to model this N:M relationship.

Signed-off-by: Petr Pícha <ppicha@xxxxxxxxxxx>
Signed-off-by: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxxxxxxxx>
---
 datamodel/codeface.mwb        | Bin 60140 -> 61237 bytes
 datamodel/codeface_schema.sql |  27 ++++++++++++++++++++++++++-
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/datamodel/codeface.mwb b/datamodel/codeface.mwb
index e7a4660..3df77be 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 06feb85..e59e6a9 100644
--- a/datamodel/codeface_schema.sql
+++ b/datamodel/codeface_schema.sql
@@ -1,5 +1,5 @@
 -- MySQL Script generated by MySQL Workbench
--- 11/28/16 17:00:18
+-- 11/28/16 17:10:02
 -- Model: New Model    Version: 1.0
 -- MySQL Workbench Forward Engineering
 
@@ -1038,6 +1038,31 @@ ENGINE = InnoDB;
 
 CREATE INDEX `field_change_issue_change_idx` ON `codeface`.`field_change` 
(`issueChangeId` ASC);
 
+
+-- -----------------------------------------------------
+-- Table `codeface`.`issue_commit`
+-- -----------------------------------------------------
+DROP TABLE IF EXISTS `codeface`.`issue_commit` ;
+
+CREATE TABLE IF NOT EXISTS `codeface`.`issue_commit` (
+  `issueId` BIGINT NOT NULL,
+  `commitId` BIGINT NOT NULL,
+  CONSTRAINT `issue_commit_issue`
+    FOREIGN KEY (`issueId`)
+    REFERENCES `codeface`.`issue` (`id`)
+    ON DELETE CASCADE
+    ON UPDATE CASCADE,
+  CONSTRAINT `issue_commit_commit`
+    FOREIGN KEY (`commitId`)
+    REFERENCES `codeface`.`commit` (`id`)
+    ON DELETE CASCADE
+    ON UPDATE CASCADE)
+ENGINE = InnoDB;
+
+CREATE INDEX `issue_commit_issue_idx` ON `codeface`.`issue_commit` (`issueId` 
ASC);
+
+CREATE INDEX `issue_commit_commit_idx` ON `codeface`.`issue_commit` 
(`commitId` ASC);
+
 USE `codeface` ;
 
 -- -----------------------------------------------------
-- 
2.8.3


Other related posts:

  • » [codeface] [PATCH 05/10] Create a relationship between issues and commits in DB - Wolfgang Mauerer