move awardsplayers
This commit is contained in:
parent
8583b6332f
commit
042ac946d7
3
Makefile
3
Makefile
|
@ -9,7 +9,7 @@ baseball.db: baseball-transformed.db sql/load.sql
|
||||||
cat sql/load.sql | sqlite3 baseball.db
|
cat sql/load.sql | sqlite3 baseball.db
|
||||||
sqlite3 baseball.db "VACUUM"
|
sqlite3 baseball.db "VACUUM"
|
||||||
|
|
||||||
baseball-transformed.db: baseball-raw.db sql/awards.sql sql/franchises.sql sql/teamseasons.sql sql/seasons.sql sql/parks.sql sql/collegeplaying.sql sql/schools.sql sql/people.sql sql/salaries.sql sql/batting.sql sql/pitching.sql sql/fielding.sql sql/appearances.sql sql/homegames.sql sql/seriespost.sql sql/fieldingofsplit.sql sql/teams.sql sql/leagues.sql sql/managers.sql sql/awardsmanagers.sql sql/battingpost.sql sql/fieldingpost.sql sql/pitchingpost.sql sql/appearancespost.sql sql/awardsshareplayers.sql sql/yearlyawards.sql sql/halloffame.sql sql/halloffamereqs.sql
|
baseball-transformed.db: baseball-raw.db sql/awards.sql sql/franchises.sql sql/teamseasons.sql sql/seasons.sql sql/parks.sql sql/collegeplaying.sql sql/schools.sql sql/people.sql sql/salaries.sql sql/batting.sql sql/pitching.sql sql/fielding.sql sql/appearances.sql sql/homegames.sql sql/seriespost.sql sql/fieldingofsplit.sql sql/teams.sql sql/leagues.sql sql/managers.sql sql/awardsmanagers.sql sql/battingpost.sql sql/fieldingpost.sql sql/pitchingpost.sql sql/appearancespost.sql sql/awardsshareplayers.sql sql/yearlyawards.sql sql/halloffame.sql sql/halloffamereqs.sql sql/awardsplayers.sql
|
||||||
rm -f baseball-transformed.db
|
rm -f baseball-transformed.db
|
||||||
cp baseball-raw.db baseball-transformed.db
|
cp baseball-raw.db baseball-transformed.db
|
||||||
cat sql/franchises.sql | sqlite3 baseball-transformed.db
|
cat sql/franchises.sql | sqlite3 baseball-transformed.db
|
||||||
|
@ -40,6 +40,7 @@ baseball-transformed.db: baseball-raw.db sql/awards.sql sql/franchises.sql sql/t
|
||||||
cat sql/yearlyawards.sql | sqlite3 baseball-transformed.db
|
cat sql/yearlyawards.sql | sqlite3 baseball-transformed.db
|
||||||
cat sql/halloffame.sql | sqlite3 baseball-transformed.db
|
cat sql/halloffame.sql | sqlite3 baseball-transformed.db
|
||||||
cat sql/halloffamereqs.sql | sqlite3 baseball-transformed.db
|
cat sql/halloffamereqs.sql | sqlite3 baseball-transformed.db
|
||||||
|
cat sql/awardsplayers.sql | sqlite3 baseball-transformed.db
|
||||||
|
|
||||||
baseball-raw.db:
|
baseball-raw.db:
|
||||||
rm -f baseball-raw.db
|
rm -f baseball-raw.db
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
BEGIN;
|
|
||||||
CREATE TABLE IF NOT EXISTS "pk_awardsplayers" (
|
|
||||||
"playerID" TEXT,
|
|
||||||
"awardID" TEXT,
|
|
||||||
"yearID" NUMERIC,
|
|
||||||
"lgID" TEXT,
|
|
||||||
"tie" TEXT,
|
|
||||||
"notes" TEXT,
|
|
||||||
PRIMARY KEY("awardID","yearID","lgID","notes","playerID"),
|
|
||||||
foreign key("playerID") references "people"("playerID")
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO "pk_awardsplayers" SELECT DISTINCT * FROM "awardsplayers";
|
|
||||||
DROP TABLE "awardsplayers";
|
|
||||||
ALTER TABLE "pk_awardsplayers" RENAME TO "awardsplayers";
|
|
||||||
COMMIT;
|
|
13
sql/load.sql
13
sql/load.sql
|
@ -565,4 +565,17 @@ create table if not exists "halloffamereqs" (
|
||||||
);
|
);
|
||||||
|
|
||||||
insert into halloffamereqs select distinct * from "transformed".halloffamereqs;
|
insert into halloffamereqs select distinct * from "transformed".halloffamereqs;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS "awardsplayers" (
|
||||||
|
"player" TEXT,
|
||||||
|
"award" TEXT,
|
||||||
|
"year" NUMERIC,
|
||||||
|
"league" TEXT,
|
||||||
|
"notes" TEXT,
|
||||||
|
PRIMARY KEY("award","year","league","notes","player"),
|
||||||
|
foreign key("player") references "people"("ID"),
|
||||||
|
foreign key("award","year","league") references "yearlyawards"("award","year","league")
|
||||||
|
);
|
||||||
|
|
||||||
|
insert into awardsplayers select distinct * from "transformed".awardsplayers;
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
Loading…
Reference in New Issue