diff options
Diffstat (limited to 'sqitch')
-rw-r--r-- | sqitch/deploy/build_status_add_unique_index.sql | 18 | ||||
-rw-r--r-- | sqitch/revert/build_status_add_unique_index.sql | 7 | ||||
-rw-r--r-- | sqitch/sqitch.plan | 1 | ||||
-rw-r--r-- | sqitch/verify/build_status_add_unique_index.sql | 7 |
4 files changed, 33 insertions, 0 deletions
diff --git a/sqitch/deploy/build_status_add_unique_index.sql b/sqitch/deploy/build_status_add_unique_index.sql new file mode 100644 index 0000000..0ba5e6c --- /dev/null +++ b/sqitch/deploy/build_status_add_unique_index.sql @@ -0,0 +1,18 @@ +-- Deploy guix-data-service:build_status_add_unique_index to pg + +BEGIN; + +DELETE FROM build_status +WHERE id NOT IN ( + SELECT MIN(id) FROM build_status GROUP BY build_id, timestamp, status +); + +ALTER TABLE build_status +ADD CONSTRAINT build_status_build_id_timestamp_status_unique +UNIQUE (build_id, timestamp, status); + +CREATE UNIQUE INDEX build_status_build_id_status_unique_idx + ON build_status (build_id, status) + WHERE timestamp IS NULL; + +COMMIT; diff --git a/sqitch/revert/build_status_add_unique_index.sql b/sqitch/revert/build_status_add_unique_index.sql new file mode 100644 index 0000000..2f801ee --- /dev/null +++ b/sqitch/revert/build_status_add_unique_index.sql @@ -0,0 +1,7 @@ +-- Revert guix-data-service:build_status_add_unique_index from pg + +BEGIN; + +-- XXX Add DDLs here. + +COMMIT; diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan index f3c4272..318d2c6 100644 --- a/sqitch/sqitch.plan +++ b/sqitch/sqitch.plan @@ -63,3 +63,4 @@ translations_for_lint_checker_descriptions 2020-05-22T19:49:37Z daniela <daniela 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 build_add_build_server_build_id 2020-06-27T12:48:57Z Christopher Baines <mail@cbaines.net> # Add builds.build_server_build_id +build_status_add_unique_index 2020-06-30T17:19:30Z Christopher Baines <mail@cbaines.net> # Add a unique index to the build_status table diff --git a/sqitch/verify/build_status_add_unique_index.sql b/sqitch/verify/build_status_add_unique_index.sql new file mode 100644 index 0000000..1415c06 --- /dev/null +++ b/sqitch/verify/build_status_add_unique_index.sql @@ -0,0 +1,7 @@ +-- Verify guix-data-service:build_status_add_unique_index on pg + +BEGIN; + +-- XXX Add verifications here. + +ROLLBACK; |