This builds further on https://akkoma.dev/AkkomaGang/akkoma/pulls/350 , but i made it a separate PR so we can keep changes smaller in the hope that this makes reviewing easier. Do let me know if it's better to keep the whole thing as one PR.
After pruning objects, we still have a whole bunch of activities that don't link to anything existing any more. Here we find and delete those activities.
* [x] Make a first working thing
* [x] Make it work for also object-arrays
* [x] Dogfood (woof woof)
* The first run, it had to prune 2+ years worth of activities and took over 24h to complete
* I then ran on a daily basis and it takes 20-30min each time
* After vacuum full, my DB size went from ~10G to ~3G ?
* [x] Docs
* [x] While we're at it, improve the docs to explain the vacuum full and mention autovacuum (could also be a separate MR). See https://akkoma.dev/AkkomaGang/akkoma/issues/436#issuecomment-6948
* https://docs.akkoma.dev/develop/administration/CLI_tasks/database/#prune-old-remote-posts-from-the-database
* https://docs.akkoma.dev/develop/configuration/postgresql/
* Autovacumm should be on by default according to Postgresql docs, so it doesn't seem like something I should add here.
* Maybe other places where it makes sense...
* Also added it to the vacuum task. Otherwise the only postgresql references I see in the docs are in the install guides.
I made this an option because it may cause extra load, time, and risk.
Note that I also check what tables we have in the DB. As explained in the comments of the test, this is because the objects that the activities point to can be stored in different tables. Currently I see three of them, but it's possible we add more tables in the future. If those tables also hold objects and we don't check there, we may delete activities who shouldn't be deleted. For that reason I make a test fail when a new table is added.