use yearlyawards table for foreign key constraints

This commit is contained in:
Nick Griffey 2024-01-28 13:07:12 -06:00
parent 09b33302aa
commit dfd2b78fb2
1 changed files with 3 additions and 9 deletions

View File

@ -382,9 +382,7 @@ CREATE TABLE IF NOT EXISTS "awardsmanagers" (
"notes" TEXT,
PRIMARY KEY("manager","award","year","league"),
foreign key("manager") references "people"("ID"),
foreign key("award") references "awards"("ID"),
foreign key("year") references "seasons"("year"),
foreign key("league") references "leagues"("ID")
foreign key("award","year","league") references "yearlyawards"("award","year","league")
);
insert into awardsmanagers select distinct * from "transformed"."awardsmanagers";
@ -511,9 +509,7 @@ CREATE TABLE IF NOT EXISTS "awardssharemanagers" (
"votesFirst" NUMERIC,
PRIMARY KEY("manager","award","year","league"),
foreign key("manager") references "people"("ID"),
foreign key("award") references "awards"("ID"),
foreign key("year") references "seasons"("year"),
foreign key("league") references "leagues"("ID")
foreign key("award","year","league") references "yearlyawards"("award","year","league")
);
insert into awardssharemanagers select distinct * from "transformed"."awardssharemanagers";
@ -528,9 +524,7 @@ CREATE TABLE IF NOT EXISTS "awardsshareplayers" (
"votesFirst" NUMERIC,
PRIMARY KEY("award","year","player","league"),
foreign key("player") references "people"("ID"),
foreign key("award") references "awards"("ID"),
foreign key("year") references "seasons"("year"),
foreign key("league") references "leagues"("ID")
foreign key("award","year","league") references "yearlyawards"("award","year","league")
);
insert into awardsshareplayers select distinct * from "transformed"."awardsshareplayers";