diff options
author | Christopher Baines <mail@cbaines.net> | 2023-02-13 19:26:44 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2023-02-13 19:26:44 +0000 |
commit | 078516e0ab67916b8b428580c7deaf0c12097e13 (patch) | |
tree | 532cd82e96e2b99ef06a4614c92f9f3e36cb194b | |
parent | 6be113f99d52cc284ecd0ed07fc88df5ea7bf718 (diff) | |
download | data-service-078516e0ab67916b8b428580c7deaf0c12097e13.tar data-service-078516e0ab67916b8b428580c7deaf0c12097e13.tar.gz |
Improve dropping package_derivation_by_guix_revision_range partitions
-rw-r--r-- | guix-data-service/data-deletion.scm | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/guix-data-service/data-deletion.scm b/guix-data-service/data-deletion.scm index 6794bea..a91d02b 100644 --- a/guix-data-service/data-deletion.scm +++ b/guix-data-service/data-deletion.scm @@ -24,6 +24,7 @@ #:use-module (fibers) #:use-module (guix-data-service utils) #:use-module (guix-data-service database) + #:use-module (guix-data-service model git-branch) #:use-module (guix-data-service model package-derivation-by-guix-revision-range) #:export (delete-guix-revisions delete-data-for-branch @@ -213,18 +214,16 @@ WHERE id IN ( (delete-from-git-commits conn) (delete-jobs conn) - (exec-query - conn - " -DELETE FROM package_derivations_by_guix_revision_range -WHERE git_branch_id IN ( - SELECT id - FROM git_branches - WHERE git_repository_id = $1 AND - name = $2 -)" - (list (number->string git-repository-id) - branch-name)) + (let ((git-branch-id + (git-branch-for-repository-and-name conn + git-repository-id + branch-name))) + (exec-query + conn + (string-append + " +DROP TABLE package_derivations_by_guix_revision_range_git_branch_" + (number->string git-branch-id) ";"))) (delete-guix-revisions conn git-repository-id commits)))) |