aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-06-27 13:35:34 +0100
committerChristopher Baines <mail@cbaines.net>2020-06-27 14:05:51 +0100
commit1d48885e6a4c245e3a65185f1768b40b5a47e883 (patch)
tree73fafb49e54eeeb35647ed5e514975547355c483
parentd687928a04307ef9bdd9d811197aeba377bcfa01 (diff)
downloaddata-service-1d48885e6a4c245e3a65185f1768b40b5a47e883.tar
data-service-1d48885e6a4c245e3a65185f1768b40b5a47e883.tar.gz
Make build_status.timestamp nullable
The Guix Build Coordinator doesn't record timestamps for events currently. This is something to fix, but allow for build statuses without timestamps as they're not necessary.
-rw-r--r--guix-data-service/model/build-status.scm8
-rw-r--r--sqitch/deploy/build_status_nullable_timestamp.sql7
-rw-r--r--sqitch/revert/build_status_nullable_timestamp.sql7
-rw-r--r--sqitch/sqitch.plan1
-rw-r--r--sqitch/verify/build_status_nullable_timestamp.sql7
5 files changed, 27 insertions, 3 deletions
diff --git a/guix-data-service/model/build-status.scm b/guix-data-service/model/build-status.scm
index ebcc023..1a9d7f7 100644
--- a/guix-data-service/model/build-status.scm
+++ b/guix-data-service/model/build-status.scm
@@ -75,9 +75,11 @@ VALUES "
"("
(number->string build-id)
","
- (string-append "to_timestamp("
- (number->string timestamp)
- ")")
+ (if timestamp
+ (string-append "to_timestamp("
+ (number->string timestamp)
+ ")")
+ "NULL")
","
(quote-string status)
")")))
diff --git a/sqitch/deploy/build_status_nullable_timestamp.sql b/sqitch/deploy/build_status_nullable_timestamp.sql
new file mode 100644
index 0000000..3474cac
--- /dev/null
+++ b/sqitch/deploy/build_status_nullable_timestamp.sql
@@ -0,0 +1,7 @@
+-- Deploy guix-data-service:build_status_nullable_timestamp to pg
+
+BEGIN;
+
+ALTER TABLE build_status ALTER COLUMN timestamp DROP NOT NULl;
+
+COMMIT;
diff --git a/sqitch/revert/build_status_nullable_timestamp.sql b/sqitch/revert/build_status_nullable_timestamp.sql
new file mode 100644
index 0000000..28125fd
--- /dev/null
+++ b/sqitch/revert/build_status_nullable_timestamp.sql
@@ -0,0 +1,7 @@
+-- Revert guix-data-service:build_status_nullable_timestamp from pg
+
+BEGIN;
+
+-- XXX Add DDLs here.
+
+COMMIT;
diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan
index dc0d147..c494c55 100644
--- a/sqitch/sqitch.plan
+++ b/sqitch/sqitch.plan
@@ -61,3 +61,4 @@ build_servers_lookup_builds 2020-05-24T15:18:09Z Christopher Baines <mail@cbaine
make_nar_urls_file_size_optional 2020-06-03T05:27:29Z Christopher Baines <mail@cbaines.net> # Make the nar_urls.file_size optional
translations_for_lint_checker_descriptions 2020-05-22T19:49:37Z daniela <daniela@linux-ijv5> # Support translations for lint checker descriptions
translations_for_package_synopsis_and_descriptions 2020-06-09T12:42:54Z daniela <daniela@linux-ijv5> # Support translations for package synopsis and descriptions
+build_status_nullable_timestamp 2020-06-27T12:34:29Z Christopher Baines <mail@cbaines.net> # Make build_status.timestamp nullable
diff --git a/sqitch/verify/build_status_nullable_timestamp.sql b/sqitch/verify/build_status_nullable_timestamp.sql
new file mode 100644
index 0000000..a9f5097
--- /dev/null
+++ b/sqitch/verify/build_status_nullable_timestamp.sql
@@ -0,0 +1,7 @@
+-- Verify guix-data-service:build_status_nullable_timestamp on pg
+
+BEGIN;
+
+-- XXX Add verifications here.
+
+ROLLBACK;