diff --git a/sql/allstargames.sql b/sql/allstargames.sql index 341e0ee..d328e41 100644 --- a/sql/allstargames.sql +++ b/sql/allstargames.sql @@ -29,7 +29,7 @@ where game = ''; create table if not exists allstargames ( "year" numeric, "gameNum" numeric, - "game" text, + "game" text unique, primary key("year","gameNum"), foreign key("year") references "seasons"("year") ); diff --git a/sql/allstarstartingpos.sql b/sql/allstarstartingpos.sql index 228c560..12086f2 100644 --- a/sql/allstarstartingpos.sql +++ b/sql/allstarstartingpos.sql @@ -45,6 +45,7 @@ CREATE TABLE "allstarstartingpos" ( "league" NUMERIC, "startingPos" NUMERIC, primary key("year","gameNum","league","startingPos"), + unique("year","gameNum","league","startingPos"), foreign key("player","year","gameNum") references "allstars"("player","year","gameNum"), foreign key("league") references "leagues"("ID") ); diff --git a/sql/people.sql b/sql/people.sql index 3b9e328..ea7a928 100644 --- a/sql/people.sql +++ b/sql/people.sql @@ -12,6 +12,14 @@ insert into people values ('fowlebu99', 1858, 3, 16, 'USA', 'NY', 'Fort Plain', 1913, 2, 26, 'USA', 'NY', 'Frankfort', 'Bud', 'Fowler', 'John W. Jackson', 155, 67, 'R', 'R', null, null, null, 'fowlebu99'), ('thompan01', null, null, null, null, null, null, null, null, null, null, null, null, null, 'Thompson', null, null, null, null, null, '1875-04-26', '1875-05-17', null, 'thompan01'); +update people +set bbrefID = null +where bbrefID = ''; + +update people +set retroID = null +where retroID = ''; + CREATE TABLE main."people" ( "ID" text, "birthYear" NUMERIC, @@ -35,8 +43,8 @@ CREATE TABLE main."people" ( "throws" text, "debut" text, "finalGame" text, - "retroID" text, - "bbrefID" text, + "retroID" text unique, + "bbrefID" text unique, primary key("ID") ); diff --git a/sql/teamseasons.sql b/sql/teamseasons.sql index 32a8ebd..c1cc0be 100644 --- a/sql/teamseasons.sql +++ b/sql/teamseasons.sql @@ -65,6 +65,9 @@ create table if not exists main."teamseasons" ( "teamIDlahman45" TEXT, "teamIDretro" TEXT, PRIMARY KEY("year","team"), + UNIQUE("year","teamIDBR"), + UNIQUE("year","teamIDlahman45"), + UNIQUE("year","teamIDretro"), foreign key("year") references "seasons"("year"), foreign key("league") references "leagues"("ID"), foreign key("team") references "teams"("ID")