Compare commits

..

No commits in common. "6e17945d338d95e3033928c2dce81480f92a4faa" and "06648907517bdd4176204dd7824e84a2abec2ff4" have entirely different histories.

3 changed files with 5 additions and 7 deletions

View File

@ -3,7 +3,7 @@
from [the Lahman database/Baseball Databank](https://seanlahman.com).
A makefile and SQL scripts are provided that can create a database from
Lahman's CSV files. Ideally, this means that as long as new releases continue
Lahman's CSV files. Ideally, this means that as long as new releases continue,
(and the structure of the releases is maintained), an up-to-date database can
be created. I have also done my best to normalize the data, incorporate
constraints, and correct errors I've found.

View File

@ -15,8 +15,6 @@ this program. If not, see <https://www.gnu.org/licenses/>.
*/
pragma foreign_keys = 0;
-- check constraints are disabled for this file because the G_of constraint fails for a lot of records and i don't feel like correcting it right now
pragma ignore_check_constraints = 1;
begin;
attach database 'lahman-raw.db' as 'raw';
@ -124,7 +122,8 @@ CREATE TABLE IF NOT EXISTS "appearances" (
"G_lf" NUMERIC check ("G_lf" <= "G_all"),
"G_cf" NUMERIC check ("G_cf" <= "G_all"),
"G_rf" NUMERIC check ("G_rf" <= "G_all"),
"G_of" NUMERIC check ("G_of" <= "G_all"),
-- there should be a G_of <= G_all constraint, but there's a lot of rows that fail and i don't feel like correcting them right now
"G_of" NUMERIC,
"G_dh" NUMERIC check ("G_dh" <= "G_all"),
"G_ph" NUMERIC check ("G_ph" <= "G_all"),
"G_pr" NUMERIC check ("G_pr" <= "G_all"),

View File

@ -15,8 +15,6 @@ this program. If not, see <https://www.gnu.org/licenses/>.
*/
pragma foreign_keys = 0;
-- checks are disabled because there's a check for if inducted is Y or N, but there are too many rows i don't feel like correcting right now
pragma ignore_check_constraints = 1;
begin;
attach database 'lahman-raw.db' as 'raw';
@ -46,7 +44,8 @@ CREATE TABLE IF NOT EXISTS main."halloffame" (
"ballots" TEXT,
"needed" TEXT,
"votes" NUMERIC,
"inducted" TEXT check ("inducted" in ('Y','N')),
-- we could have a check for if inducted is Y or N, but there are too many rows i don't feel like correcting right now
"inducted" TEXT,
"category" TEXT,
"needed_note" text,
PRIMARY KEY("player","year","votedBy")