13 lines
757 B
MySQL
13 lines
757 B
MySQL
|
|
TRUNCATE TABLE "season_template_sports";
|
||
|
|
--> statement-breakpoint
|
||
|
|
ALTER TABLE "season_template_sports" DROP CONSTRAINT "season_template_sports_sports_season_id_sports_seasons_id_fk";
|
||
|
|
--> statement-breakpoint
|
||
|
|
ALTER TABLE "season_template_sports" ADD COLUMN "sport_id" uuid NOT NULL;--> statement-breakpoint
|
||
|
|
DO $$ BEGIN
|
||
|
|
ALTER TABLE "season_template_sports" ADD CONSTRAINT "season_template_sports_sport_id_sports_id_fk" FOREIGN KEY ("sport_id") REFERENCES "public"."sports"("id") ON DELETE cascade ON UPDATE no action;
|
||
|
|
EXCEPTION
|
||
|
|
WHEN duplicate_object THEN null;
|
||
|
|
END $$;
|
||
|
|
--> statement-breakpoint
|
||
|
|
ALTER TABLE "season_template_sports" DROP COLUMN IF EXISTS "sports_season_id";--> statement-breakpoint
|
||
|
|
ALTER TABLE "season_templates" DROP COLUMN IF EXISTS "year";
|