Migration 0003_invite

This commit is contained in:
db9979 committed 2026-11-26 21:04:09 +01:00
1 parent df73317a5e
commit 55fc5f1571
3 files changed
+2236

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
CREATE TABLE "invite_block" (
"email_hash" text PRIMARY KEY NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "player_invite" (
"id" serial PRIMARY KEY NOT NULL,
"code" text NOT NULL,
"inviter_id" integer NOT NULL,
"channel" text NOT NULL,
"email" text,
"friend_name" text,
"message" text,
"block_token" text,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"expires_at" timestamp with time zone NOT NULL,
"sent_at" timestamp with time zone,
"send_count" integer DEFAULT 0 NOT NULL,
"revoked_at" timestamp with time zone,
"accepted_at" timestamp with time zone,
"accepted_player_id" integer
);
--> statement-breakpoint
ALTER TABLE "player_invite" ADD CONSTRAINT "player_invite_code_invite_code_code_fk" FOREIGN KEY ("code") REFERENCES "public"."invite_code"("code") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player_invite" ADD CONSTRAINT "player_invite_inviter_id_player_id_fk" FOREIGN KEY ("inviter_id") REFERENCES "public"."player"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "player_invite" ADD CONSTRAINT "player_invite_accepted_player_id_player_id_fk" FOREIGN KEY ("accepted_player_id") REFERENCES "public"."player"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
CREATE UNIQUE INDEX "player_invite_code" ON "player_invite" USING btree ("code");--> statement-breakpoint
CREATE UNIQUE INDEX "player_invite_block" ON "player_invite" USING btree ("block_token");--> statement-breakpoint
CREATE INDEX "player_invite_inviter" ON "player_invite" USING btree ("inviter_id","created_at");--> statement-breakpoint
CREATE INDEX "player_invite_email" ON "player_invite" USING btree (lower("email"));--> statement-breakpoint
CREATE INDEX "player_invite_accepted" ON "player_invite" USING btree ("accepted_player_id");
File diff suppressed because it is too large. Load diff
@@ -22,6 +22,13 @@
"when": 1795720614928,
"tag": "0002_ops",
"breakpoints": true
},
{
"idx": 3,
"version": "7",
"when": 1795723441660,
"tag": "0003_invite",
"breakpoints": true
}
]
}