summaryrefslogtreecommitdiff
path: root/gentoobrowse-api/service/sql/maintenance/packagePrune.sql
diff options
context:
space:
mode:
Diffstat (limited to 'gentoobrowse-api/service/sql/maintenance/packagePrune.sql')
-rw-r--r--gentoobrowse-api/service/sql/maintenance/packagePrune.sql7
1 files changed, 7 insertions, 0 deletions
diff --git a/gentoobrowse-api/service/sql/maintenance/packagePrune.sql b/gentoobrowse-api/service/sql/maintenance/packagePrune.sql
new file mode 100644
index 0000000..510ed75
--- /dev/null
+++ b/gentoobrowse-api/service/sql/maintenance/packagePrune.sql
@@ -0,0 +1,7 @@
+DELETE FROM gentoobrowse.packages p
+USING gentoobrowse.categories c
+WHERE p.categoryid = c.categoryid
+AND c.name = ?
+AND NOT EXISTS (
+ SELECT FROM gentoobrowse.ebuilds e
+ WHERE p.packageid = e.packageid)