15 lines
447 B
PL/PgSQL
15 lines
447 B
PL/PgSQL
BEGIN;
|
|
CREATE TABLE IF NOT EXISTS "pk_collegeplaying" (
|
|
"playerID" TEXT,
|
|
"schoolID" TEXT,
|
|
"yearID" NUMERIC,
|
|
PRIMARY KEY("playerID","yearID","schoolID"),
|
|
foreign key("playerID") references "people"("playerID"),
|
|
foreign key("schoolID") references "schools"("schoolID")
|
|
);
|
|
|
|
INSERT INTO "pk_collegeplaying" SELECT DISTINCT * FROM "collegeplaying";
|
|
DROP TABLE "collegeplaying";
|
|
ALTER TABLE "pk_collegeplaying" RENAME TO "collegeplaying";
|
|
COMMIT;
|