[LNT] r240194 - FieldChanges need to be deleted as well to maintain references

Chris Matthews cmatthews5 at apple.com
Fri Jun 19 16:48:25 PDT 2015


Author: cmatthews
Date: Fri Jun 19 18:48:25 2015
New Revision: 240194

URL: http://llvm.org/viewvc/llvm-project?rev=240194&view=rev
Log:
FieldChanges need to be deleted as well to maintain references

Modified:
    lnt/trunk/lnt/lnttool/updatedb.py

Modified: lnt/trunk/lnt/lnttool/updatedb.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/lnttool/updatedb.py?rev=240194&r1=240193&r2=240194&view=diff
==============================================================================
--- lnt/trunk/lnt/lnttool/updatedb.py (original)
+++ lnt/trunk/lnt/lnttool/updatedb.py Fri Jun 19 18:48:25 2015
@@ -47,7 +47,7 @@ def action_updatedb(name, args):
             for id, in ts.query(ts.Run.id).\
                 join(ts.Machine).\
                 filter(ts.Machine.name.in_(opts.delete_machines)))
-
+        
     # Delete all samples associated with those runs.
     ts.query(ts.Sample).\
         filter(ts.Sample.run_id.in_(runs_to_delete)).\
@@ -60,6 +60,12 @@ def action_updatedb(name, args):
 
     # Delete the machines.
     for name in opts.delete_machines:
+        # Delete all FieldChanges associated with this machine.
+        ids = ts.query(ts.FieldChange.id).\
+            join(ts.Machine).filter(ts.Machine.name == name).all()
+        for i in ids:
+            ts.query(ts.FieldChange).filter(ts.FieldChange.id == i[0]).delete()
+
         num_deletes = ts.query(ts.Machine).filter_by(name=name).delete()
         if num_deletes == 0:
             warning("unable to find machine named: %r" % name)





More information about the llvm-commits mailing list