[ews-app] Set Foreign Keys in EWS Django app models
authoraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Nov 2018 21:44:27 +0000 (21:44 +0000)
committeraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Nov 2018 21:44:27 +0000 (21:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191790

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-app/ews/models/builds.py: Set Foreign Key.
* BuildSlaveSupport/ews-app/ews/models/steps.py: Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238518 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/BuildSlaveSupport/ews-app/ews/models/builds.py
Tools/BuildSlaveSupport/ews-app/ews/models/steps.py
Tools/ChangeLog

index d320b3b..de18f2c 100644 (file)
 from __future__ import unicode_literals
 
 from django.db import models
+from ews.models.patch import Patch
 
 
 class Builds(models.Model):
-    patchid = models.IntegerField()  # TODO: set foreign key
+    patch = models.ForeignKey(Patch, on_delete=models.CASCADE)
     buildid = models.IntegerField(primary_key=True)
     builderid = models.IntegerField()
     number = models.IntegerField()
index b9dadf6..dae8f53 100644 (file)
 from __future__ import unicode_literals
 
 from django.db import models
+from ews.models.builds import Builds
 
 
 class Steps(models.Model):
     stepid = models.IntegerField(primary_key=True)
-    buildid = models.IntegerField()  # TODO: set foreign key
+    build = models.ForeignKey(Builds, on_delete=models.CASCADE)
     result = models.IntegerField()
     state_string = models.TextField()
     started_at = models.IntegerField()
@@ -36,4 +37,4 @@ class Steps(models.Model):
     modified = models.DateTimeField(auto_now=True)
 
     def __str__(self):
-        return str(self.buildid)
+        return str(self.stepid)
index 7e965c3..1af3754 100644 (file)
@@ -1,5 +1,15 @@
 2018-11-26  Aakash Jain  <aakash_jain@apple.com>
 
+        [ews-app] Set Foreign Keys in EWS Django app models
+        https://bugs.webkit.org/show_bug.cgi?id=191790
+
+        Reviewed by Lucas Forschler.
+
+        * BuildSlaveSupport/ews-app/ews/models/builds.py: Set Foreign Key.
+        * BuildSlaveSupport/ews-app/ews/models/steps.py: Ditto.
+
+2018-11-26  Aakash Jain  <aakash_jain@apple.com>
+
         [ews-app] Do not store patch content in database
         https://bugs.webkit.org/show_bug.cgi?id=191788