17 lines
435 B
PL/PgSQL
17 lines
435 B
PL/PgSQL
BEGIN;
|
|
CREATE TABLE IF NOT EXISTS "pk_awardsmanagers" (
|
|
"playerID" TEXT,
|
|
"awardID" TEXT,
|
|
"yearID" NUMERIC,
|
|
"lgID" TEXT,
|
|
"tie" TEXT,
|
|
"notes" TEXT,
|
|
PRIMARY KEY("awardID","yearID","lgID","playerID"),
|
|
foreign key("playerID") references "people"("playerID")
|
|
);
|
|
|
|
INSERT INTO "pk_awardsmanagers" SELECT DISTINCT * FROM "awardsmanagers";
|
|
DROP TABLE "awardsmanagers";
|
|
ALTER TABLE "pk_awardsmanagers" RENAME TO "awardsmanagers";
|
|
COMMIT;
|