use yearlyawards table for foreign key constraints
This commit is contained in:
parent
09b33302aa
commit
dfd2b78fb2
12
sql/load.sql
12
sql/load.sql
|
@ -382,9 +382,7 @@ CREATE TABLE IF NOT EXISTS "awardsmanagers" (
|
||||||
"notes" TEXT,
|
"notes" TEXT,
|
||||||
PRIMARY KEY("manager","award","year","league"),
|
PRIMARY KEY("manager","award","year","league"),
|
||||||
foreign key("manager") references "people"("ID"),
|
foreign key("manager") references "people"("ID"),
|
||||||
foreign key("award") references "awards"("ID"),
|
foreign key("award","year","league") references "yearlyawards"("award","year","league")
|
||||||
foreign key("year") references "seasons"("year"),
|
|
||||||
foreign key("league") references "leagues"("ID")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
insert into awardsmanagers select distinct * from "transformed"."awardsmanagers";
|
insert into awardsmanagers select distinct * from "transformed"."awardsmanagers";
|
||||||
|
@ -511,9 +509,7 @@ CREATE TABLE IF NOT EXISTS "awardssharemanagers" (
|
||||||
"votesFirst" NUMERIC,
|
"votesFirst" NUMERIC,
|
||||||
PRIMARY KEY("manager","award","year","league"),
|
PRIMARY KEY("manager","award","year","league"),
|
||||||
foreign key("manager") references "people"("ID"),
|
foreign key("manager") references "people"("ID"),
|
||||||
foreign key("award") references "awards"("ID"),
|
foreign key("award","year","league") references "yearlyawards"("award","year","league")
|
||||||
foreign key("year") references "seasons"("year"),
|
|
||||||
foreign key("league") references "leagues"("ID")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
insert into awardssharemanagers select distinct * from "transformed"."awardssharemanagers";
|
insert into awardssharemanagers select distinct * from "transformed"."awardssharemanagers";
|
||||||
|
@ -528,9 +524,7 @@ CREATE TABLE IF NOT EXISTS "awardsshareplayers" (
|
||||||
"votesFirst" NUMERIC,
|
"votesFirst" NUMERIC,
|
||||||
PRIMARY KEY("award","year","player","league"),
|
PRIMARY KEY("award","year","player","league"),
|
||||||
foreign key("player") references "people"("ID"),
|
foreign key("player") references "people"("ID"),
|
||||||
foreign key("award") references "awards"("ID"),
|
foreign key("award","year","league") references "yearlyawards"("award","year","league")
|
||||||
foreign key("year") references "seasons"("year"),
|
|
||||||
foreign key("league") references "leagues"("ID")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
insert into awardsshareplayers select distinct * from "transformed"."awardsshareplayers";
|
insert into awardsshareplayers select distinct * from "transformed"."awardsshareplayers";
|
||||||
|
|
Loading…
Reference in New Issue