SPB Git forge

spb/spinza

Public
8commits 1branches 0releases
1.6 MBsize
maindefault branch
16 days agolast push
TypeScript 97.6% SQL 1.4% JavaScript 0.5%
1.5 KB · 27 lines sql
Raw Blame History
1CREATE TABLE "crash_rounds" (2	"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,3	"round_id" varchar(32) NOT NULL,4	"user_id" uuid NOT NULL,5	"game_id" uuid NOT NULL,6	"game_slug" varchar(64) NOT NULL,7	"game_version" varchar(16) NOT NULL,8	"client_round_id" uuid NOT NULL,9	"bet" bigint NOT NULL,10	"crash_multiplier" numeric(12, 2) NOT NULL,11	"crash_at_ms" integer NOT NULL,12	"seed" text NOT NULL,13	"commitment" varchar(64) NOT NULL,14	"events" jsonb DEFAULT '[]'::jsonb NOT NULL,15	"auto_cashout" numeric(12, 2),16	"status" varchar(12) DEFAULT 'running' NOT NULL,17	"cashout_multiplier" numeric(12, 2),18	"win" bigint DEFAULT 0 NOT NULL,19	"started_at" timestamp with time zone DEFAULT now() NOT NULL,20	"settled_at" timestamp with time zone21);22--> statement-breakpoint23ALTER TABLE "crash_rounds" ADD CONSTRAINT "crash_rounds_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint24ALTER TABLE "crash_rounds" ADD CONSTRAINT "crash_rounds_game_id_games_id_fk" FOREIGN KEY ("game_id") REFERENCES "public"."games"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint25CREATE UNIQUE INDEX "crash_rounds_round_id_idx" ON "crash_rounds" USING btree ("round_id");--> statement-breakpoint26CREATE UNIQUE INDEX "crash_rounds_user_client_idx" ON "crash_rounds" USING btree ("user_id","client_round_id");--> statement-breakpoint27CREATE INDEX "crash_rounds_user_status_idx" ON "crash_rounds" USING btree ("user_id","status");