blob: 44f55f24906794cbabce266cd2ed6e44c74caa13 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#!/usr/bin/env php
<?php
require __DIR__ . '/../vendor/autoload.php';
$db = Digitigrade\Db::getInstance()->getPdo();
$db->beginTransaction();
$db->exec(<<<END
-- permanently delete anything marked for deletion
DELETE FROM actor WHERE deleted = true;
DELETE FROM note WHERE deleted = true;
DELETE FROM interaction WHERE deleted = true;
-- remove old timeline items and notifications
DELETE FROM home_timeline_item WHERE modified < (current_timestamp - interval '6 months');
DELETE FROM notification WHERE created < (current_timestamp - interval '1 month');
-- throw away old sessions that would be too old anyway
DELETE FROM session WHERE created < (current_timestamp - interval '1 year');
END);
$db->commit();
|