move managers
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
begin;
|
||||
alter table managers drop column "lgID";
|
||||
alter table managers drop column "rank";
|
||||
commit;
|
||||
@@ -1,19 +0,0 @@
|
||||
BEGIN;
|
||||
CREATE TABLE IF NOT EXISTS "pk_managers" (
|
||||
"playerID" TEXT,
|
||||
"yearID" NUMERIC,
|
||||
"teamID" TEXT,
|
||||
"lgID" TEXT,
|
||||
"inseason" NUMERIC,
|
||||
"G" NUMERIC,
|
||||
"W" NUMERIC,
|
||||
"L" NUMERIC,
|
||||
"rank" NUMERIC,
|
||||
"plyrMgr" TEXT,
|
||||
PRIMARY KEY("playerID","yearID","teamID","inseason"),
|
||||
foreign key("playerID") references "people"("playerID")
|
||||
);
|
||||
INSERT INTO "pk_managers" SELECT DISTINCT * FROM "managers";
|
||||
DROP TABLE "managers";
|
||||
ALTER TABLE "pk_managers" RENAME TO "managers";
|
||||
COMMIT;
|
||||
16
sql/load.sql
16
sql/load.sql
@@ -356,4 +356,20 @@ create table if not exists "leagues" (
|
||||
);
|
||||
|
||||
insert into leagues select distinct * from "transformed"."leagues";
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "managers" (
|
||||
"ID" TEXT,
|
||||
"year" NUMERIC,
|
||||
"team" TEXT,
|
||||
"inseason" NUMERIC,
|
||||
"G" NUMERIC,
|
||||
"W" NUMERIC,
|
||||
"L" NUMERIC,
|
||||
"plyrMgr" TEXT,
|
||||
PRIMARY KEY("ID","year","team","inseason"),
|
||||
foreign key("ID") references "people"("ID"),
|
||||
foreign key("year","team") references "teamseasons"("year","team")
|
||||
);
|
||||
|
||||
insert into managers select distinct * from "transformed"."managers";
|
||||
COMMIT;
|
||||
|
||||
12
sql/managers.sql
Normal file
12
sql/managers.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
begin;
|
||||
alter table managers drop column "lgID";
|
||||
alter table managers drop column "rank";
|
||||
|
||||
update managers
|
||||
set teamid = 'WS9'
|
||||
where teamid = 'WAS' and yearid between 1891 and 1899;
|
||||
|
||||
update managers
|
||||
set teamid = 'PHP'
|
||||
where teamid = 'PH4' and yearid between 1890 and 1891;
|
||||
commit;
|
||||
Reference in New Issue
Block a user