Fix allstar tables

This commit is contained in:
2024-01-27 12:35:39 -06:00
parent 498b3ba308
commit 8ba209aea4
4 changed files with 35 additions and 19 deletions
+34
View File
@@ -0,0 +1,34 @@
begin;
create table if not exists allstargames (
"yearID" numeric,
"gameNum" numeric,
"gameID" text,
primary key("yearID","gameNum")
);
insert into allstargames
select distinct yearid, gamenum, gameid
from allstarfull;
alter table allstarfull drop column "gameID";
alter table allstarfull rename to "allstarstartingpos";
create table if not exists "allstars" (
"playerID" text,
"yearID" text,
"gameNum" text,
"teamID" text,
"GP" numeric,
primary key("playerID","yearID","gameNum"),
foreign key("playerID") references "people"("playerID")
);
insert into allstars
select distinct playerid, yearid, gamenum, teamid, gp
from allstarstartingpos;
alter table allstarstartingpos drop column "teamid";
alter table allstarstartingpos drop column "lgID";
alter table allstarstartingpos drop column "gp";
commit;
-14
View File
@@ -1,14 +0,0 @@
begin;
create table if not exists allstargames (
"yearID" numeric,
"gameNum" numeric,
"gameID" text,
primary key("yearID","gameNum")
);
insert into allstargames
select distinct yearid, gamenum, gameid
from allstarfull;
alter table allstarfull drop column "gameID";
commit;
-3
View File
@@ -1,3 +0,0 @@
begin;
alter table allstarfull drop column "lgID";
commit;