handle 1945 all-star game not being played
This commit is contained in:
		
							parent
							
								
									fbd9e4b669
								
							
						
					
					
						commit
						d4729206da
					
				| 
						 | 
					@ -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;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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")
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue