From b684475684fecd7b2ef213e10c1e4c86b7d28bfe Mon Sep 17 00:00:00 2001 From: Armen Zambrano Date: Fri, 22 May 2020 17:07:28 -0400 Subject: [PATCH] docs: Instruction on how to delete data for a project (#6449) --- docs/backend_tasks.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/backend_tasks.md b/docs/backend_tasks.md index 55ebcba16..34162f064 100644 --- a/docs/backend_tasks.md +++ b/docs/backend_tasks.md @@ -121,3 +121,18 @@ Other services running inside the Compose project, can be accessed in the same w [client git log]: https://github.com/mozilla/treeherder/commits/master/treeherder/client [client.py]: https://github.com/mozilla/treeherder/blob/master/treeherder/client/thclient/client.py [bug 1236965]: https://bugzilla.mozilla.org/show_bug.cgi?id=1236965 + +## Reset a disposable project + +Engineers can [book a repository](https://wiki.mozilla.org/ReleaseEngineering/DisposableProjectRepositories) for +some time and might want to start using Treeherder with a clean slate. Read the following steps to remove old data. + +```bash +heroku run --app treeherder-stage bash +./manage.py shell +>>> from treeherder.model.models import Push, Repository +>>> repo_name = "pine" # Change this to what you want +>>> repo_id = Repository.objects.filter(name=repo_name)[0].id +>>> Push.objects.filter(repository=repo_id).delete() +(121433, {'model.Commit': 120289, 'perf.PerformanceDatum': 0, 'perf.PerformanceAlertSummary': 4, 'model.Push': 1140}) +```