server/drizzle/migrations/0040_good_nocturne.sql
Jesse Wierzbinski d55668d529
fix(database): 💩 Replace uuid_generate_v7 in migrations to a dummy PostgreSQL function
Prevents a fatal error when running migrations on vanilla PostgreSQL instance without the pg_uuidv7 extension
2025-03-30 22:32:04 +02:00

15 lines
636 B
SQL

CREATE TABLE "PushSubscriptions" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"endpoint" text NOT NULL,
"public_key" text NOT NULL,
"auth_secret" text NOT NULL,
"alerts" jsonb NOT NULL,
"policy" text NOT NULL,
"created_at" timestamp(3) DEFAULT now() NOT NULL,
"updated_at" timestamp(3) DEFAULT now() NOT NULL,
"tokenId" uuid NOT NULL,
CONSTRAINT "PushSubscriptions_tokenId_unique" UNIQUE("tokenId")
);
--> statement-breakpoint
ALTER TABLE "PushSubscriptions" ADD CONSTRAINT "PushSubscriptions_tokenId_Tokens_id_fk" FOREIGN KEY ("tokenId") REFERENCES "public"."Tokens"("id") ON DELETE cascade ON UPDATE cascade;