Site administration
Delete the events of one person
A person asks you to delete their analytics events. Delete their events and their rows of the rankings from ClickHouse.
1 min read
You need:
- The Source repository with wrangler signed in, on your computer.
- To be signed in to the server as root. See Sign in to the server.
1. Load the files of dead/ first
If dead/ has files, load them first, as Load the batches that never got in shows. A file that you load later brings back the events of the person.
2. Find the user id of the person
On your computer, run:
pnpm -C apps/web exec wrangler d1 execute DB --remote --command "SELECT id FROM users WHERE username = '<username>'"
3. Delete their events
On the server, delete their events, and their rows of the rankings:
clickhouse-client --password "$(cat /root/.clickhouse-admin)" --query "DELETE FROM analytics.events WHERE distinct_id = '<user id>'"
clickhouse-client --password "$(cat /root/.clickhouse-admin)" --query "DELETE FROM analytics.rank_actions WHERE person_id = '<user id>'"
The scores of the repositories change at the next run of the ranking cron, in 15 minutes or less. Awards that Source gave before do not change.
Done
Queries stop showing these rows at once. ClickHouse removes them from the disk when it next merges the parts of the table.
Note
The backups keep a copy of these events for up to 8 days. Then R2 deletes the last backup that has them.