move managershalf
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
BEGIN;
|
||||
CREATE TABLE IF NOT EXISTS "pk_managershalf" (
|
||||
"playerID" TEXT,
|
||||
"yearID" NUMERIC,
|
||||
"teamID" TEXT,
|
||||
"lgID" TEXT,
|
||||
"inseason" NUMERIC,
|
||||
"half" NUMERIC,
|
||||
"G" NUMERIC,
|
||||
"W" NUMERIC,
|
||||
"L" NUMERIC,
|
||||
"rank" NUMERIC,
|
||||
PRIMARY KEY("playerID","yearID","teamID","inseason","half"),
|
||||
foreign key("playerID") references "people"("playerID")
|
||||
);
|
||||
|
||||
INSERT INTO "pk_managershalf" SELECT DISTINCT * FROM "managershalf";
|
||||
DROP TABLE "managershalf";
|
||||
ALTER TABLE "pk_managershalf" RENAME TO "managershalf";
|
||||
COMMIT;
|
||||
16
sql/load.sql
16
sql/load.sql
@@ -593,4 +593,20 @@ CREATE TABLE IF NOT EXISTS "teamseasonshalf" (
|
||||
);
|
||||
|
||||
insert into teamseasonshalf select distinct * from "transformed".teamseasonshalf;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "managershalf" (
|
||||
"ID" TEXT,
|
||||
"year" NUMERIC,
|
||||
"team" TEXT,
|
||||
"inseason" NUMERIC,
|
||||
"half" NUMERIC,
|
||||
"G" NUMERIC,
|
||||
"W" NUMERIC,
|
||||
"L" NUMERIC,
|
||||
PRIMARY KEY("ID","year","team","inseason","half"),
|
||||
foreign key("ID") references "people"("ID"),
|
||||
foreign key("year","team") references "teamseasons"("year","team")
|
||||
);
|
||||
|
||||
insert into managershalf select distinct * from "transformed".managershalf;
|
||||
COMMIT;
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
begin;
|
||||
alter table managershalf drop column "lgID";
|
||||
alter table managershalf drop column "rank";
|
||||
|
||||
update managershalf
|
||||
set teamid = 'WS9'
|
||||
where yearid = 1892 and teamid = 'WAS';
|
||||
commit;
|
||||
Reference in New Issue
Block a user