move awardsmanagers

This commit is contained in:
Nick Griffey 2024-01-27 23:29:53 -06:00
parent 3a60d30ff8
commit 56807b1027
4 changed files with 17 additions and 17 deletions

View File

@ -9,7 +9,7 @@ baseball.db: baseball-transformed.db sql/load.sql
cat sql/load.sql | sqlite3 baseball.db
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
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
rm -f baseball-transformed.db
cp baseball-raw.db baseball-transformed.db
cat sql/franchises.sql | sqlite3 baseball-transformed.db
@ -31,6 +31,7 @@ baseball-transformed.db: baseball-raw.db sql/awards.sql sql/franchises.sql sql/t
cat sql/teams.sql | sqlite3 baseball-transformed.db
cat sql/leagues.sql | sqlite3 baseball-transformed.db
cat sql/managers.sql | sqlite3 baseball-transformed.db
cat sql/awardsmanagers.sql | sqlite3 baseball-transformed.db
baseball-raw.db:
rm -f baseball-raw.db

View File

@ -1,16 +0,0 @@
BEGIN;
CREATE TABLE IF NOT EXISTS "pk_awardsmanagers" (
"playerID" TEXT,
"awardID" TEXT,
"yearID" NUMERIC,
"lgID" TEXT,
"tie" TEXT,
"notes" TEXT,
PRIMARY KEY("awardID","yearID","lgID","playerID"),
foreign key("playerID") references "people"("playerID")
);
INSERT INTO "pk_awardsmanagers" SELECT DISTINCT * FROM "awardsmanagers";
DROP TABLE "awardsmanagers";
ALTER TABLE "pk_awardsmanagers" RENAME TO "awardsmanagers";
COMMIT;

View File

@ -372,4 +372,19 @@ CREATE TABLE IF NOT EXISTS "managers" (
);
insert into managers select distinct * from "transformed"."managers";
CREATE TABLE IF NOT EXISTS "awardsmanagers" (
"manager" TEXT,
"award" TEXT,
"year" NUMERIC,
"league" TEXT,
"notes" TEXT,
PRIMARY KEY("manager","award","year","league"),
foreign key("manager") references "people"("ID"),
foreign key("year") references "seasons"("year"),
foreign key("award") references "awards"("ID"),
foreign key("league") references "leagues"("ID")
);
insert into awardsmanagers select distinct * from "transformed"."awardsmanagers";
COMMIT;