[LNT] r307992 - testsuitedb: Specify backrelations with cascading behavior

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 13 19:05:03 PDT 2017


Author: matze
Date: Thu Jul 13 19:05:03 2017
New Revision: 307992

URL: http://llvm.org/viewvc/llvm-project?rev=307992&view=rev
Log:
testsuitedb: Specify backrelations with cascading behavior

Apart from making the structure more explicit this should make deletion
code a lot easier.

Modified:
    lnt/trunk/lnt/server/db/testsuitedb.py

Modified: lnt/trunk/lnt/server/db/testsuitedb.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/testsuitedb.py?rev=307992&r1=307991&r2=307992&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/testsuitedb.py (original)
+++ lnt/trunk/lnt/server/db/testsuitedb.py Thu Jul 13 19:05:03 2017
@@ -350,6 +350,11 @@ class TestSuiteDB(object):
                 self.order
                 return strip(self.__dict__)
 
+        Machine.runs = relation(Run, back_populates='machine',
+                                cascade="all, delete-orphan")
+        Order.runs = relation(Run, back_populates='order',
+                              cascade="all, delete-orphan")
+
         class Test(self.base, ParameterizedMixin):
             __tablename__ = db_key_name + '_Test'
 
@@ -500,6 +505,9 @@ class TestSuiteDB(object):
             def __json__(self):
                 return strip(self.__dict__)
 
+        Run.samples = relation(Sample, back_populates='run',
+                               cascade="all, delete-orphan")
+
         class FieldChange(self.base, ParameterizedMixin):
             """FieldChange represents a change in between the values
             of the same field belonging to two samples from consecutive runs.
@@ -552,6 +560,9 @@ class TestSuiteDB(object):
                 self.end_order
                 return strip(self.__dict__)
 
+        Run.fieldchanges = relation(FieldChange, back_populates='run',
+                                    cascade="all, delete-orphan")
+
         class Regression(self.base, ParameterizedMixin):
             """Regressions hold data about a set of RegressionIndices."""
 
@@ -610,6 +621,10 @@ class TestSuiteDB(object):
                         u'Regression': self.regression,
                         u'FieldChange': self.field_change}
 
+        FieldChange.regression_indicators = \
+            relation(RegressionIndicator, back_populates='field_change',
+                     cascade="all, delete-orphan")
+
         class ChangeIgnore(self.base, ParameterizedMixin):
             """Changes to ignore in the web interface."""
 




More information about the llvm-commits mailing list