fix foreign key violations cascading from fixing team ids

This commit is contained in:
Nick Griffey 2024-01-27 22:53:07 -06:00
parent f2f6f04a39
commit 00f197d89f
5 changed files with 40 additions and 0 deletions

View File

@ -1,3 +1,11 @@
begin;
alter table "appearances" drop column "lgID";
update appearances
set teamid = 'WS9'
where teamid = 'WAS' and yearid between 1891 and 1899;
update appearances
set teamid = 'PHP'
where teamid = 'PH4' and yearid between 1890 and 1891;
commit;

View File

@ -1,3 +1,11 @@
begin;
alter table batting drop column "lgID";
update batting
set teamid = 'WS9'
where teamid = 'WAS' and yearid between 1891 and 1899;
update batting
set teamid = 'PHP'
where teamid = 'PH4' and yearid between 1890 and 1891;
commit;

View File

@ -1,3 +1,11 @@
begin;
alter table fielding drop column "lgID";
update fielding
set teamid = 'WS9'
where teamid = 'WAS' and yearid between 1891 and 1899;
update fielding
set teamid = 'PHP'
where teamid = 'PH4' and yearid between 1890 and 1891;
commit;

View File

@ -1,3 +1,11 @@
begin;
alter table "homegames" drop column "league.key";
update homegames
set "team.key" = 'WS9'
where "team.key" = 'WAS' and "year.key" between 1891 and 1899;
update homegames
set "team.key" = 'PHP'
where "team.key" = 'PH4' and "year.key" between 1890 and 1891;
commit;

View File

@ -1,3 +1,11 @@
begin;
alter table pitching drop column "lgID";
update pitching
set teamid = 'WS9'
where teamid = 'WAS' and yearid between 1891 and 1899;
update pitching
set teamid = 'PHP'
where teamid = 'PH4' and yearid between 1890 and 1891;
commit;