From 5d06a28577f6a917ebacd3d6e7aab1a7c61c6e27 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sun, 2 Jun 2019 22:00:29 +0100 Subject: Add more detailed new revision job handling Create a new events table for the new guix revision jobs, and update this when processing a job starts, as well as finished with success or failure. Additionally, remove the dependnency on open-inferior/container, as this functionality isn't merged in to Guix master yet. --- sqitch/deploy/load_new_guix_revision_job_events.sql | 18 ++++++++++++++++++ sqitch/revert/load_new_guix_revision_job_events.sql | 12 ++++++++++++ sqitch/sqitch.plan | 1 + sqitch/verify/load_new_guix_revision_job_events.sql | 8 ++++++++ 4 files changed, 39 insertions(+) create mode 100644 sqitch/deploy/load_new_guix_revision_job_events.sql create mode 100644 sqitch/revert/load_new_guix_revision_job_events.sql create mode 100644 sqitch/verify/load_new_guix_revision_job_events.sql (limited to 'sqitch') diff --git a/sqitch/deploy/load_new_guix_revision_job_events.sql b/sqitch/deploy/load_new_guix_revision_job_events.sql new file mode 100644 index 0000000..96731fb --- /dev/null +++ b/sqitch/deploy/load_new_guix_revision_job_events.sql @@ -0,0 +1,18 @@ +-- Deploy guix-data-service:load_new_guix_revision_job_events to pg + +BEGIN; + +CREATE TYPE job_event AS ENUM ('start', 'failure', 'success'); + +ALTER TABLE ONLY load_new_guix_revision_jobs + ADD CONSTRAINT load_new_guix_revision_jobs_id UNIQUE (id); + +CREATE TABLE load_new_guix_revision_job_events ( + id integer GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, + job_id integer NOT NULL, + event job_event NOT NULL, + occurred_at timestamp without time zone NOT NULL DEFAULT clock_timestamp(), + CONSTRAINT job_id FOREIGN KEY (job_id) REFERENCES load_new_guix_revision_jobs (id) +); + +COMMIT; diff --git a/sqitch/revert/load_new_guix_revision_job_events.sql b/sqitch/revert/load_new_guix_revision_job_events.sql new file mode 100644 index 0000000..a0a1eec --- /dev/null +++ b/sqitch/revert/load_new_guix_revision_job_events.sql @@ -0,0 +1,12 @@ +-- Revert guix-data-service:load_new_guix_revision_job_events from pg + +BEGIN; + +DROP TABLE load_new_guix_revision_job_events; + +ALTER TABLE load_new_guix_revision_jobs + DROP CONSTRAINT load_new_guix_revision_jobs_id; + +DROP TYPE IF EXISTS job_event; + +COMMIT; diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan index b4c873d..56619b9 100644 --- a/sqitch/sqitch.plan +++ b/sqitch/sqitch.plan @@ -12,3 +12,4 @@ add_location_information 2019-05-12T20:27:48Z Christopher Baines # Add cgit_url_base to git_repositories license_support 2019-05-13T20:37:40Z Christopher Baines # Add support for storing license information dates_to_load_new_guix_revision_jobs 2019-06-02T07:39:49Z Christopher Baines # Add dates to the load_new_guix_revision_jobs table +load_new_guix_revision_job_events 2019-06-02T15:44:41Z Christopher Baines # Add new table for guix_revision_job_events diff --git a/sqitch/verify/load_new_guix_revision_job_events.sql b/sqitch/verify/load_new_guix_revision_job_events.sql new file mode 100644 index 0000000..9ea2196 --- /dev/null +++ b/sqitch/verify/load_new_guix_revision_job_events.sql @@ -0,0 +1,8 @@ +-- Verify guix-data-service:load_new_guix_revision_job_events on pg + +BEGIN; + +SELECT id, job_id, event, occurred_at + FROM load_new_guix_revision_job_events WHERE FALSE; + +ROLLBACK; -- cgit v1.2.3