handle 1945 all-star game not being played

This commit is contained in:
Nick Griffey 2024-01-27 11:32:11 -06:00
parent fbd9e4b669
commit d4729206da
3 changed files with 10 additions and 6 deletions

View File

@ -1,15 +1,14 @@
begin; begin;
create table if not exists allstargames ( create table if not exists allstargames (
"gameID" text,
"yearID" numeric, "yearID" numeric,
"gameNum" numeric, "gameNum" numeric,
primary key("gameID") "gameID" text,
primary key("yearID","gameNum")
); );
insert into allstargames insert into allstargames
select distinct gameid, yearid, gamenum select distinct yearid, gamenum, gameid
from allstarfull; from allstarfull;
alter table allstarfull drop column "yearID"; alter table allstarfull drop column "gameID";
alter table allstarfull drop column "gameNum";
commit; commit;

View File

@ -11,4 +11,9 @@ where gameid = 'NLS196207300';
-- david freese has two all-star entries for 2012, one in AL -- david freese has two all-star entries for 2012, one in AL
delete from allstarfull delete from allstarfull
where playerid = 'freesda01' and yearid = 2012 and lgid = 'AL'; where playerid = 'freesda01' and yearid = 2012 and lgid = 'AL';
-- 1945 all-star game wasn't played so some rows have no game id
update allstarfull
set gameid = null
where gameid = '';
commit; commit;

View File

@ -8,7 +8,7 @@ CREATE TABLE "pk_allstarfull" (
"lgID" NUMERIC, "lgID" NUMERIC,
"GP" NUMERIC, "GP" NUMERIC,
"startingPos" NUMERIC, "startingPos" NUMERIC,
primary key("playerID","gameID","startingPos"), primary key("playerID","yearID","gameNum","startingPos"),
foreign key("playerID") references "people"("playerID") foreign key("playerID") references "people"("playerID")
); );