1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-25 07:49:37 +02:00
AdventureLog/migrations/0008_romantic_maria_hill.sql

12 lines
432 B
SQL

CREATE TABLE IF NOT EXISTS "userVisitedAdventures" (
"user_id" text NOT NULL,
"adventure_name" text NOT NULL,
"location" text,
"adventure_visited" text
);
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "userVisitedAdventures" ADD CONSTRAINT "userVisitedAdventures_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;