move awardsshare tables
This commit is contained in:
parent
0157dd859a
commit
9924917547
|
@ -1,17 +0,0 @@
|
||||||
begin;
|
|
||||||
CREATE TABLE IF NOT EXISTS "pk_awardssharemanagers" (
|
|
||||||
"awardID" TEXT,
|
|
||||||
"yearID" NUMERIC,
|
|
||||||
"lgID" TEXT,
|
|
||||||
"playerID" TEXT,
|
|
||||||
"pointsWon" NUMERIC,
|
|
||||||
"pointsMax" NUMERIC,
|
|
||||||
"votesFirst" NUMERIC,
|
|
||||||
PRIMARY KEY("playerID","awardID","yearID","lgID"),
|
|
||||||
foreign key("playerID") references "people"("playerID")
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO "pk_awardssharemanagers" SELECT DISTINCT * FROM "awardssharemanagers";
|
|
||||||
DROP TABLE "awardssharemanagers";
|
|
||||||
ALTER TABLE "pk_awardssharemanagers" RENAME TO "awardssharemanagers";
|
|
||||||
commit;
|
|
|
@ -1,17 +0,0 @@
|
||||||
begin;
|
|
||||||
CREATE TABLE IF NOT EXISTS "pk_awardsshareplayers" (
|
|
||||||
"awardID" TEXT,
|
|
||||||
"yearID" NUMERIC,
|
|
||||||
"lgID" TEXT,
|
|
||||||
"playerID" TEXT,
|
|
||||||
"pointsWon" NUMERIC,
|
|
||||||
"pointsMax" NUMERIC,
|
|
||||||
"votesFirst" NUMERIC,
|
|
||||||
PRIMARY KEY("awardID","yearID","playerID","lgID"),
|
|
||||||
foreign key("playerID") references "people"("playerID")
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO "pk_awardsshareplayers" SELECT DISTINCT * FROM "awardsshareplayers";
|
|
||||||
DROP TABLE "awardsshareplayers";
|
|
||||||
ALTER TABLE "pk_awardsshareplayers" RENAME TO "awardsshareplayers";
|
|
||||||
commit;
|
|
36
sql/load.sql
36
sql/load.sql
|
@ -382,8 +382,8 @@ 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("year") references "seasons"("year"),
|
|
||||||
foreign key("award") references "awards"("ID"),
|
foreign key("award") references "awards"("ID"),
|
||||||
|
foreign key("year") references "seasons"("year"),
|
||||||
foreign key("league") references "leagues"("ID")
|
foreign key("league") references "leagues"("ID")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -500,4 +500,38 @@ CREATE TABLE IF NOT EXISTS "fieldingof" (
|
||||||
);
|
);
|
||||||
|
|
||||||
insert into fieldingof select distinct * from "transformed"."fieldingof";
|
insert into fieldingof select distinct * from "transformed"."fieldingof";
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS "awardssharemanagers" (
|
||||||
|
"award" TEXT,
|
||||||
|
"year" NUMERIC,
|
||||||
|
"league" TEXT,
|
||||||
|
"manager" TEXT,
|
||||||
|
"pointsWon" NUMERIC,
|
||||||
|
"pointsMax" NUMERIC,
|
||||||
|
"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")
|
||||||
|
);
|
||||||
|
|
||||||
|
insert into awardssharemanagers select distinct * from "transformed"."awardssharemanagers";
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS "awardsshareplayers" (
|
||||||
|
"award" TEXT,
|
||||||
|
"year" NUMERIC,
|
||||||
|
"league" TEXT,
|
||||||
|
"player" TEXT,
|
||||||
|
"pointsWon" NUMERIC,
|
||||||
|
"pointsMax" NUMERIC,
|
||||||
|
"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")
|
||||||
|
);
|
||||||
|
|
||||||
|
insert into awardsshareplayers select distinct * from "transformed"."awardsshareplayers";
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
Loading…
Reference in New Issue