autoimport: this is not how foreign key constraints work
authorHelmut Grohne <helmut@subdivi.de>
Mon, 25 Feb 2013 07:55:53 +0000 (08:55 +0100)
committerHelmut Grohne <helmut@subdivi.de>
Mon, 25 Feb 2013 07:55:53 +0000 (08:55 +0100)
autoimport.py

index 02ac58e..a7ea5ff 100755 (executable)
@@ -38,6 +38,10 @@ def main():
     delpkgs = set(knownpkgs) - distpkgs
     print("clearing packages %s" % " ".join(delpkgs))
     cur.execute("PRAGMA foreign_keys=1;")
+    cur.executemany("DELETE FROM content WHERE package = ?;",
+                    ((pkg,) for pkg in delpkgs))
+    cur.executemany("DELETE FROM dependency WHERE package = ?;",
+                    ((pkg,) for pkg in delpkgs))
     cur.executemany("DELETE FROM package WHERE package = ?;",
                     ((pkg,) for pkg in delpkgs))
     db.commit()