1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-08-04 12:45:17 +02:00
AdventureLog/migrations/0002_glamorous_junta.sql

12 lines
444 B
MySQL
Raw Normal View History

2024-04-11 23:58:09 +00:00
CREATE TABLE IF NOT EXISTS "worldTravelRegions" (
"id" serial PRIMARY KEY NOT NULL,
"name" text NOT NULL,
"country_id" text NOT NULL
);
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "worldTravelRegions" ADD CONSTRAINT "worldTravelRegions_country_id_worldTravelCountries_id_fk" FOREIGN KEY ("country_id") REFERENCES "worldTravelCountries"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;