Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history

0017_merge_queue.sql

Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.

0017_merge_queue.sqlBlame33 lines · 1 contributor
a79a9edClaude1-- Gluecron migration 0017: Block E5 — Merge queues.
2--
3-- Serialised merge: instead of merging a PR immediately, it's appended to
4-- a queue scoped on (repository_id, base_branch). A worker (or manual
5-- process-next button for v1) pops the head, re-runs gates against the
6-- latest base, and if green actually merges. If red, kicks the PR back
7-- with a failure comment.
8--
9-- Tables:
10-- merge_queue_entries — one row per PR currently queued / processed
11
12--> statement-breakpoint
13CREATE TABLE IF NOT EXISTS "merge_queue_entries" (
14 "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
15 "repository_id" uuid NOT NULL,
16 "pull_request_id" uuid NOT NULL,
17 "base_branch" text NOT NULL,
18 "state" text NOT NULL DEFAULT 'queued', -- queued | running | merged | failed | dequeued
19 "position" integer NOT NULL DEFAULT 0,
20 "enqueued_by" uuid,
21 "enqueued_at" timestamp DEFAULT now() NOT NULL,
22 "started_at" timestamp,
23 "finished_at" timestamp,
24 "error_message" text,
25 CONSTRAINT "merge_queue_entries_repo_fk" FOREIGN KEY ("repository_id") REFERENCES "repositories"("id") ON DELETE cascade,
26 CONSTRAINT "merge_queue_entries_pr_fk" FOREIGN KEY ("pull_request_id") REFERENCES "pull_requests"("id") ON DELETE cascade,
27 CONSTRAINT "merge_queue_entries_enqueuer_fk" FOREIGN KEY ("enqueued_by") REFERENCES "users"("id")
28);
29
30--> statement-breakpoint
31CREATE INDEX IF NOT EXISTS "merge_queue_repo_branch" ON "merge_queue_entries" ("repository_id", "base_branch", "state");
32--> statement-breakpoint
33CREATE UNIQUE INDEX IF NOT EXISTS "merge_queue_pr_active" ON "merge_queue_entries" ("pull_request_id") WHERE state IN ('queued', 'running');