1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-08-01 19:25:17 +02:00
AdventureLog/migrations/0001_fuzzy_slipstream.sql

13 lines
407 B
MySQL
Raw Normal View History

2024-06-12 17:38:34 +00:00
CREATE TABLE IF NOT EXISTS "images" (
"id" serial PRIMARY KEY NOT NULL,
"url" text NOT NULL,
"type" text NOT NULL,
"adventureId" integer
);
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "images" ADD CONSTRAINT "images_adventureId_adventures_id_fk" FOREIGN KEY ("adventureId") REFERENCES "adventures"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;