2024-01-26 01:28:46 +00:00
|
|
|
BEGIN;
|
|
|
|
CREATE TABLE IF NOT EXISTS "pk_homegames" (
|
|
|
|
"year.key" NUMERIC,
|
|
|
|
"league.key" TEXT,
|
|
|
|
"team.key" TEXT,
|
|
|
|
"park.key" TEXT,
|
|
|
|
"span.first" TEXT,
|
|
|
|
"span.last" TEXT,
|
|
|
|
"games" NUMERIC,
|
|
|
|
"openings" NUMERIC,
|
|
|
|
"attendance" NUMERIC,
|
2024-01-26 01:49:08 +00:00
|
|
|
PRIMARY KEY("year.key","team.key","park.key"),
|
|
|
|
foreign key("park.key") references "parks"("park.key")
|
2024-01-26 01:28:46 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
INSERT INTO "pk_homegames" SELECT DISTINCT * FROM "homegames";
|
|
|
|
DROP TABLE "homegames";
|
|
|
|
ALTER TABLE "pk_homegames" RENAME TO "homegames";
|
|
|
|
COMMIT;
|