aboutsummaryrefslogtreecommitdiffhomepage
path: root/bin/cleandb
blob: 4aa7b37b57aef7fe5ddb29bed208f6386f3ad97b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/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');

END);
$db->commit();