From 94d2ba9901fb206b76de920ed0c0470a7fed7ea7 Mon Sep 17 00:00:00 2001 From: Augustus Mayo Date: Mon, 25 Nov 2024 12:05:53 -0600 Subject: [PATCH] Revision index should only exist for non-deleted revisions --- .../migrations/2024-11-25-175556_fix-revision-idx/down.sql | 2 ++ rfd-model/migrations/2024-11-25-175556_fix-revision-idx/up.sql | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 rfd-model/migrations/2024-11-25-175556_fix-revision-idx/down.sql create mode 100644 rfd-model/migrations/2024-11-25-175556_fix-revision-idx/up.sql diff --git a/rfd-model/migrations/2024-11-25-175556_fix-revision-idx/down.sql b/rfd-model/migrations/2024-11-25-175556_fix-revision-idx/down.sql new file mode 100644 index 00000000..70084a5f --- /dev/null +++ b/rfd-model/migrations/2024-11-25-175556_fix-revision-idx/down.sql @@ -0,0 +1,2 @@ +DROP INDEX rfd_revision_commit_sha_idx; +CREATE UNIQUE INDEX rfd_revision_commit_sha_idx ON rfd_revision (rfd_id, commit_sha); diff --git a/rfd-model/migrations/2024-11-25-175556_fix-revision-idx/up.sql b/rfd-model/migrations/2024-11-25-175556_fix-revision-idx/up.sql new file mode 100644 index 00000000..8e33afbb --- /dev/null +++ b/rfd-model/migrations/2024-11-25-175556_fix-revision-idx/up.sql @@ -0,0 +1,2 @@ +DROP INDEX rfd_revision_commit_sha_idx; +CREATE UNIQUE INDEX rfd_revision_commit_sha_idx ON rfd_revision (rfd_id, commit_sha) WHERE deleted_at IS NULL;