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