add some check constraints, but don't enforce all of them
This commit is contained in:
parent
b079f6d1c4
commit
6f6318b5e0
|
@ -1,4 +1,5 @@
|
|||
pragma foreign_keys = 0;
|
||||
pragma ignore_check_constraints = 1;
|
||||
|
||||
begin;
|
||||
attach database 'baseball-raw.db' as 'raw';
|
||||
|
@ -38,7 +39,7 @@ CREATE TABLE IF NOT EXISTS "appearances" (
|
|||
"G_lf" NUMERIC,
|
||||
"G_cf" NUMERIC,
|
||||
"G_rf" NUMERIC,
|
||||
"G_of" NUMERIC,
|
||||
"G_of" NUMERIC check (G_of = G_lf + G_cf + G_rf),
|
||||
"G_dh" NUMERIC,
|
||||
"G_ph" NUMERIC,
|
||||
"G_pr" NUMERIC,
|
||||
|
|
|
@ -8,7 +8,7 @@ CREATE TABLE IF NOT EXISTS "awardssharemanagers" (
|
|||
"year" NUMERIC,
|
||||
"league" TEXT,
|
||||
"manager" TEXT,
|
||||
"pointsWon" NUMERIC,
|
||||
"pointsWon" NUMERIC check (pointsWon <= pointsMax),
|
||||
"pointsMax" NUMERIC,
|
||||
"votesFirst" NUMERIC,
|
||||
PRIMARY KEY("manager","award","year","league"),
|
||||
|
|
|
@ -19,7 +19,7 @@ CREATE TABLE IF NOT EXISTS main."awardsshareplayers" (
|
|||
"year" NUMERIC,
|
||||
"league" TEXT,
|
||||
"player" TEXT,
|
||||
"pointsWon" NUMERIC,
|
||||
"pointsWon" NUMERIC check (pointsWon <= pointsMax),
|
||||
"pointsMax" NUMERIC,
|
||||
"votesFirst" NUMERIC,
|
||||
PRIMARY KEY("award","year","player","league"),
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
pragma foreign_keys = 0;
|
||||
pragma ignore_check_constraints = 1;
|
||||
|
||||
begin;
|
||||
attach database 'baseball-raw.db' as 'raw';
|
||||
|
@ -15,7 +16,7 @@ CREATE TABLE IF NOT EXISTS main."fielding" (
|
|||
"stint" NUMERIC,
|
||||
"POS" TEXT,
|
||||
"G" NUMERIC,
|
||||
"GS" NUMERIC,
|
||||
"GS" NUMERIC check (GS <= G),
|
||||
"InnOuts" NUMERIC,
|
||||
"PO" NUMERIC,
|
||||
"A" NUMERIC,
|
||||
|
|
|
@ -20,7 +20,7 @@ CREATE TABLE IF NOT EXISTS main."homegames" (
|
|||
"year" NUMERIC,
|
||||
"team" TEXT,
|
||||
"park" TEXT,
|
||||
"first" TEXT,
|
||||
"first" TEXT check(unixepoch("first") <= unixepoch("last")),
|
||||
"last" TEXT,
|
||||
"games" NUMERIC,
|
||||
"openings" NUMERIC,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
pragma foreign_keys = 0;
|
||||
pragma ignore_check_constraints = 1;
|
||||
|
||||
begin;
|
||||
attach database 'baseball-raw.db' as 'raw';
|
||||
|
@ -15,14 +16,14 @@ CREATE TABLE IF NOT EXISTS main."pitching" (
|
|||
"stint" NUMERIC,
|
||||
"W" NUMERIC,
|
||||
"L" NUMERIC,
|
||||
"G" NUMERIC,
|
||||
"GS" NUMERIC,
|
||||
"CG" NUMERIC,
|
||||
"SHO" NUMERIC,
|
||||
"G" NUMERIC check (W + L + SV <= G),
|
||||
"GS" NUMERIC check (GS <= G),
|
||||
"CG" NUMERIC check (CG <= GS),
|
||||
"SHO" NUMERIC check (SHO <= CG),
|
||||
"SV" NUMERIC,
|
||||
"IPouts" NUMERIC,
|
||||
"H" NUMERIC,
|
||||
"ER" NUMERIC,
|
||||
"ER" NUMERIC check (ER <= R),
|
||||
"HR" NUMERIC,
|
||||
"BB" NUMERIC,
|
||||
"SO" NUMERIC,
|
||||
|
|
Loading…
Reference in New Issue