15 lines
520 B
SQL
15 lines
520 B
SQL
CREATE TABLE IF NOT EXISTS "webhooks" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"url" text NOT NULL,
|
|
"event" text NOT NULL,
|
|
"active" boolean DEFAULT true NOT NULL,
|
|
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
"created_by" uuid
|
|
);
|
|
--> statement-breakpoint
|
|
DO $$ BEGIN
|
|
ALTER TABLE "webhooks" ADD CONSTRAINT "webhooks_created_by_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;
|
|
EXCEPTION
|
|
WHEN duplicate_object THEN null;
|
|
END $$;
|