Skip to content

Commit e16f5c5

Browse files
committed
feat(db): add github_write_locks table for loop avoidance
1 parent 63cd11d commit e16f5c5

5 files changed

Lines changed: 1991 additions & 0 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CREATE TYPE "public"."github_write_lock_kind" AS ENUM('labels', 'assignees', 'milestone', 'state', 'title', 'comment_upsert', 'comment_delete');--> statement-breakpoint
2+
CREATE TABLE "github_write_locks" (
3+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
4+
"report_id" uuid NOT NULL,
5+
"kind" "github_write_lock_kind" NOT NULL,
6+
"signature" text NOT NULL,
7+
"expires_at" timestamp with time zone NOT NULL
8+
);
9+
--> statement-breakpoint
10+
ALTER TABLE "github_write_locks" ADD CONSTRAINT "github_write_locks_report_id_reports_id_fk" FOREIGN KEY ("report_id") REFERENCES "public"."reports"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
11+
CREATE INDEX "github_write_locks_lookup_idx" ON "github_write_locks" USING btree ("report_id","kind","expires_at");

0 commit comments

Comments
 (0)