pragma foreign_keys = 0;

begin;
attach database 'lahman-raw.db' as 'raw';

create temp table awardsplayers as 
select * from "raw".awardsplayers;
alter table temp.awardsplayers drop column "tie";

update awardsplayers
set awardid = 'Silver Slugger'
where awardid = 'SIlver Slugger';

CREATE TABLE IF NOT EXISTS main."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 main.awardsplayers select distinct * from temp.awardsplayers;
commit;
