aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/hlr-remove-old.sql
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-07-04 23:08:44 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2017-08-27 17:40:52 +0200
commited3157ce46cde0f3973a5ee0a0a53909f361ae7c (patch)
tree072f9b723003554bead716390f6ed8bf7351d103 /contrib/hlr-remove-old.sql
parent2758330b6ab37ff30afca8306080f0e82ef5a732 (diff)
move openbsc/* to repos root
This is the first step in creating this repository from the legacy openbsc.git. Like all other Osmocom repositories, keep the autoconf and automake files in the repository root. openbsc.git has been the sole exception, which ends now. Change-Id: I9c6f2a448d9cb1cc088cf1cf6918b69d7e69b4e7
Diffstat (limited to 'contrib/hlr-remove-old.sql')
-rw-r--r--contrib/hlr-remove-old.sql18
1 files changed, 18 insertions, 0 deletions
diff --git a/contrib/hlr-remove-old.sql b/contrib/hlr-remove-old.sql
new file mode 100644
index 000000000..626a331e1
--- /dev/null
+++ b/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;