Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

MUL-6786: index GitHub PR head SHA lookups (#7695)

Multica Eve3fecc553e24c
diff --git a/server/cmd/migrate/main.go b/server/cmd/migrate/main.go
index 2d276cd288..80726e5037 100644
--- a/server/cmd/migrate/main.go
+++ b/server/cmd/migrate/main.go
@@ -273,6 +273,7 @@ var concurrentIndexCleanups = map[string]string{
"430_channel_outbound_message_binding_index": "idx_channel_outbound_message_binding_route",
"438_agent_runtime_online_last_seen_index": "idx_agent_runtime_online_last_seen",
"439_agent_runtime_offline_last_seen_index": "idx_agent_runtime_offline_last_seen",
+ "440_github_pr_head_sha_index": "idx_github_pull_request_head_sha",
}
// concurrentDownIndexCleanups covers every migration whose down direction
diff --git a/server/migrations/440_github_pr_head_sha_index.down.sql b/server/migrations/440_github_pr_head_sha_index.down.sql
new file mode 100644
index 0000000000..7b19afcaa2
--- /dev/null
+++ b/server/migrations/440_github_pr_head_sha_index.down.sql
@@ -0,0 +1 @@
+DROP INDEX CONCURRENTLY IF EXISTS idx_github_pull_request_head_sha;
diff --git a/server/migrations/440_github_pr_head_sha_index.up.sql b/server/migrations/440_github_pr_head_sha_index.up.sql
new file mode 100644
index 0000000000..33d91462c3
--- /dev/null
+++ b/server/migrations/440_github_pr_head_sha_index.up.sql
@@ -0,0 +1,4 @@
+-- Head SHA is selective enough to narrow the CI-webhook fallback to the few
+-- mirrored rows whose installation and repository are then checked by SQL.
+CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_github_pull_request_head_sha
+ ON github_pull_request (head_sha);