aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2012-09-07 19:09:10 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2012-09-07 19:09:10 +0200
commit037065deeed3d239a562bb7a900bb01e5146a09d (patch)
tree7758d243289c4ee92157a61df04a166360d1df08 /openbsc
parente4227988665cae6e44fc0f77c2463aae759f15ca (diff)
contrib: Add some SQL statements to remove old subscribers
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/contrib/hlr-remove-old.sql18
1 files changed, 18 insertions, 0 deletions
diff --git a/openbsc/contrib/hlr-remove-old.sql b/openbsc/contrib/hlr-remove-old.sql
new file mode 100644
index 000000000..626a331e1
--- /dev/null
+++ b/openbsc/contrib/hlr-remove-old.sql
@@ -0,0 +1,18 @@
+-- Remove old data from the database
+DELETE FROM Subscriber
+ WHERE id != 1 AND datetime('now', '-10 days') > updated AND authorized != 1;
+DELETE FROM Equipment
+ WHERE datetime('now', '-10 days') > updated;
+DELETE FROM EquipmentWatch
+ WHERE datetime('now', '-10 days') > updated;
+DELETE FROM SMS
+ WHERE datetime('now', '-10 days') > created;
+DELETE FROM VLR
+ WHERE datetime('now', '-10 days') > updated;
+DELETE FROM ApduBlobs
+ WHERE datetime('now', '-10 days') > created;
+DELETE FROM Counters
+ WHERE datetime('now', '-10 days') > timestamp;
+DELETE FROM RateCounters
+ WHERE datetime('now', '-10 days') > timestamp;
+VACUUM;