18 lines
504 B
PL/PgSQL
18 lines
504 B
PL/PgSQL
begin;
|
|
CREATE TABLE IF NOT EXISTS "pk_awardssharemanagers" (
|
|
"awardID" TEXT,
|
|
"yearID" NUMERIC,
|
|
"lgID" TEXT,
|
|
"playerID" TEXT,
|
|
"pointsWon" NUMERIC,
|
|
"pointsMax" NUMERIC,
|
|
"votesFirst" NUMERIC,
|
|
PRIMARY KEY("playerID","awardID","yearID","lgID"),
|
|
foreign key("playerID") references "people"("playerID")
|
|
);
|
|
|
|
INSERT INTO "pk_awardssharemanagers" SELECT DISTINCT * FROM "awardssharemanagers";
|
|
DROP TABLE "awardssharemanagers";
|
|
ALTER TABLE "pk_awardssharemanagers" RENAME TO "awardssharemanagers";
|
|
commit;
|