Remove foreign key constraints on teamid
This commit is contained in:
parent
3bd573b00d
commit
f6f17cc47c
|
@ -9,8 +9,7 @@ CREATE TABLE "pk_allstarfull" (
|
|||
"GP" NUMERIC,
|
||||
"startingPos" NUMERIC,
|
||||
primary key("playerID","yearID","gameNum","startingPos"),
|
||||
foreign key("playerID") references "people"("playerID"),
|
||||
foreign key("teamID") references "teams"("teamID")
|
||||
foreign key("playerID") references "people"("playerID")
|
||||
);
|
||||
|
||||
INSERT INTO "pk_allstarfull" SELECT DISTINCT * FROM "allstarfull";
|
||||
|
|
|
@ -22,8 +22,7 @@ CREATE TABLE IF NOT EXISTS "pk_appearances" (
|
|||
"G_ph" NUMERIC,
|
||||
"G_pr" NUMERIC,
|
||||
PRIMARY KEY("yearID","teamID","playerID"),
|
||||
foreign key("playerID") references "people"("playerID"),
|
||||
foreign key("teamID") references "teams"("teamID")
|
||||
foreign key("playerID") references "people"("playerID")
|
||||
);
|
||||
|
||||
INSERT INTO "pk_appearances" SELECT DISTINCT * FROM "appearances";
|
||||
|
|
|
@ -23,8 +23,7 @@ CREATE TABLE IF NOT EXISTS "pk_batting" (
|
|||
"SF" NUMERIC,
|
||||
"GIDP" NUMERIC,
|
||||
PRIMARY KEY("playerID","yearID","stint","teamID"),
|
||||
foreign key("playerID") references "people"("playerID"),
|
||||
foreign key("teamID") references "teams"("teamID")
|
||||
foreign key("playerID") references "people"("playerID")
|
||||
);
|
||||
|
||||
INSERT INTO "pk_batting" SELECT DISTINCT * FROM "batting";
|
||||
|
|
|
@ -23,8 +23,7 @@ CREATE TABLE IF NOT EXISTS "pk_battingpost" (
|
|||
"SF" NUMERIC,
|
||||
"GIDP" NUMERIC,
|
||||
PRIMARY KEY("yearID","playerID","round"),
|
||||
foreign key("playerID") references "people"("playerID"),
|
||||
foreign key("teamID") references "teams"("teamID")
|
||||
foreign key("playerID") references "people"("playerID")
|
||||
);
|
||||
|
||||
INSERT INTO "pk_battingpost" SELECT DISTINCT * FROM "battingpost";
|
||||
|
|
|
@ -19,8 +19,7 @@ CREATE TABLE IF NOT EXISTS "pk_fielding" (
|
|||
"CS" NUMERIC,
|
||||
"ZR" NUMERIC,
|
||||
PRIMARY KEY("playerID","yearID","stint","teamID","POS"),
|
||||
foreign key("playerID") references "people"("playerID"),
|
||||
foreign key("teamID") references "teams"("teamID")
|
||||
foreign key("playerID") references "people"("playerID")
|
||||
);
|
||||
|
||||
INSERT INTO "pk_fielding" SELECT DISTINCT * FROM "fielding";
|
||||
|
|
|
@ -19,8 +19,7 @@ CREATE TABLE IF NOT EXISTS "pk_fieldingofsplit" (
|
|||
"CS" NUMERIC,
|
||||
"ZR" NUMERIC,
|
||||
PRIMARY KEY("playerID","yearID","stint","teamID","POS"),
|
||||
foreign key("playerID") references "people"("playerID"),
|
||||
foreign key("teamID") references "teams"("teamID")
|
||||
foreign key("playerID") references "people"("playerID")
|
||||
);
|
||||
|
||||
INSERT INTO "pk_fieldingofsplit" SELECT DISTINCT * FROM "fieldingofsplit";
|
||||
|
|
|
@ -18,8 +18,7 @@ CREATE TABLE IF NOT EXISTS "pk_fieldingpost" (
|
|||
"SB" NUMERIC,
|
||||
"CS" NUMERIC,
|
||||
PRIMARY KEY("playerID","yearID","round","POS"),
|
||||
foreign key("playerID") references "people"("playerID"),
|
||||
foreign key("teamID") references "teams"("teamID")
|
||||
foreign key("playerID") references "people"("playerID")
|
||||
);
|
||||
|
||||
INSERT INTO "pk_fieldingpost" SELECT DISTINCT * FROM "fieldingpost";
|
||||
|
|
|
@ -10,7 +10,6 @@ CREATE TABLE IF NOT EXISTS "pk_homegames" (
|
|||
"openings" NUMERIC,
|
||||
"attendance" NUMERIC,
|
||||
PRIMARY KEY("year.key","team.key","park.key"),
|
||||
foreign key("team.key") references "teams"("teamID"),
|
||||
foreign key("park.key") references "parks"("park.key")
|
||||
);
|
||||
|
||||
|
|
|
@ -11,8 +11,7 @@ CREATE TABLE IF NOT EXISTS "pk_managers" (
|
|||
"rank" NUMERIC,
|
||||
"plyrMgr" TEXT,
|
||||
PRIMARY KEY("playerID","yearID","teamID","inseason"),
|
||||
foreign key("playerID") references "people"("playerID"),
|
||||
foreign key("teamID") references "teams"("teamID")
|
||||
foreign key("playerID") references "people"("playerID")
|
||||
);
|
||||
INSERT INTO "pk_managers" SELECT DISTINCT * FROM "managers";
|
||||
DROP TABLE "managers";
|
||||
|
|
|
@ -11,8 +11,7 @@ CREATE TABLE IF NOT EXISTS "pk_managershalf" (
|
|||
"L" NUMERIC,
|
||||
"rank" NUMERIC,
|
||||
PRIMARY KEY("playerID","yearID","teamID","inseason","half"),
|
||||
foreign key("playerID") references "people"("playerID"),
|
||||
foreign key("teamID") references "teams"("teamID")
|
||||
foreign key("playerID") references "people"("playerID")
|
||||
);
|
||||
|
||||
INSERT INTO "pk_managershalf" SELECT DISTINCT * FROM "managershalf";
|
||||
|
|
|
@ -31,8 +31,7 @@ CREATE TABLE IF NOT EXISTS "pk_pitching" (
|
|||
"SF" NUMERIC,
|
||||
"GIDP" NUMERIC,
|
||||
PRIMARY KEY("playerID","yearID","stint","teamID"),
|
||||
foreign key("playerID") references "people"("playerID"),
|
||||
foreign key("teamID") references "teams"("teamID")
|
||||
foreign key("playerID") references "people"("playerID")
|
||||
);
|
||||
|
||||
INSERT INTO "pk_pitching" SELECT DISTINCT * FROM "pitching";
|
||||
|
|
|
@ -31,8 +31,7 @@ CREATE TABLE IF NOT EXISTS "pk_pitchingpost" (
|
|||
"SF" NUMERIC,
|
||||
"GIDP" NUMERIC,
|
||||
PRIMARY KEY("playerID","yearID","round"),
|
||||
foreign key("playerID") references "people"("playerID"),
|
||||
foreign key("teamID") references "teams"("teamID")
|
||||
foreign key("playerID") references "people"("playerID")
|
||||
);
|
||||
|
||||
INSERT INTO "pk_pitchingpost" SELECT DISTINCT * FROM "pitchingpost";
|
||||
|
|
|
@ -6,8 +6,7 @@ CREATE TABLE IF NOT EXISTS "pk_salaries" (
|
|||
"playerID" TEXT,
|
||||
"salary" NUMERIC,
|
||||
PRIMARY KEY("yearID","playerID","teamID"),
|
||||
foreign key("playerID") references "people"("playerID"),
|
||||
foreign key("teamID") references "teams"("teamID")
|
||||
foreign key("playerID") references "people"("playerID")
|
||||
);
|
||||
|
||||
INSERT INTO "pk_salaries" SELECT DISTINCT * FROM "salaries";
|
||||
|
|
|
@ -9,9 +9,7 @@ CREATE TABLE IF NOT EXISTS "pk_seriespost" (
|
|||
"wins" NUMERIC,
|
||||
"losses" NUMERIC,
|
||||
"ties" NUMERIC,
|
||||
PRIMARY KEY("yearID","round"),
|
||||
foreign key("teamIDwinner") references "teams"("teamID"),
|
||||
foreign key("teamIDloser") references "teams"("teamID")
|
||||
PRIMARY KEY("yearID","round")
|
||||
);
|
||||
|
||||
INSERT INTO "pk_seriespost" SELECT DISTINCT * FROM "seriespost";
|
||||
|
|
|
@ -10,8 +10,7 @@ CREATE TABLE IF NOT EXISTS "pk_teamshalf" (
|
|||
"G" NUMERIC,
|
||||
"W" NUMERIC,
|
||||
"L" NUMERIC,
|
||||
PRIMARY KEY("Half","yearID","teamID"),
|
||||
foreign key("teamID") references "teams"("teamID")
|
||||
PRIMARY KEY("Half","yearID","teamID")
|
||||
);
|
||||
|
||||
INSERT INTO "pk_teamshalf" SELECT DISTINCT * FROM "teamshalf";
|
||||
|
|
Loading…
Reference in New Issue