guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: Fix create small backup issue with latest_build_s


From: Christopher Baines
Subject: branch master updated: Fix create small backup issue with latest_build_status
Date: Fri, 23 Oct 2020 15:02:07 -0400

This is an automated email from the git hooks/post-receive script.

cbaines pushed a commit to branch master
in repository data-service.

The following commit(s) were added to refs/heads/master by this push:
     new 6a7f6b5  Fix create small backup issue with latest_build_status
6a7f6b5 is described below

commit 6a7f6b5a0e939cab96b90f058accc59aa838ec4f
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Fri Oct 23 20:01:43 2020 +0100

    Fix create small backup issue with latest_build_status
---
 scripts/guix-data-service-create-small-backup | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/scripts/guix-data-service-create-small-backup 
b/scripts/guix-data-service-create-small-backup
index 2a84f42..40a4509 100755
--- a/scripts/guix-data-service-create-small-backup
+++ b/scripts/guix-data-service-create-small-backup
@@ -165,7 +165,8 @@ TRUNCATE derivations,
          guix_revision_package_derivations,
          package_derivations,
          builds,
-         build_status;
+         build_status,
+         latest_build_status;
 
 EOF
 
@@ -312,6 +313,23 @@ INSERT INTO derivation_sources
 
 INSERT INTO derivation_source_file_nars
   SELECT * FROM tmp_derivation_source_file_nars;
+
+INSERT INTO latest_build_status
+SELECT DISTINCT build_id,
+                first_value(timestamp) OVER rows_for_build AS timestamp,
+                first_value(status) OVER rows_for_build AS status
+FROM build_status
+WINDOW rows_for_build AS (
+  PARTITION BY build_id
+  ORDER BY
+    CASE WHEN status = 'scheduled' THEN -2
+         WHEN status = 'started' THEN -1
+         ELSE 0
+    END DESC,
+    timestamp DESC
+    RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
+);
+
 EOF
 
 psql -v ON_ERROR_STOP=1 --echo-queries --no-psqlrc "$URI_FOR_DATABASE" -U 
guix_data_service <<EOF



reply via email to

[Prev in Thread] Current Thread [Next in Thread]