From 6559b31024f1c45961d2347c39027f48665be4f0 Mon Sep 17 00:00:00 2001 From: James Miller Date: Wed, 14 Aug 2019 23:30:31 -0500 Subject: [PATCH] fix some but not all bugs after turning on FK enforcement --- data/armor.sql | 2 +- data/traits.sql | 2 +- schema/ancestries.sql | 2 +- schema/armor.sql | 4 ++-- schema/spells.sql | 6 +++--- schema/traits.sql | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/data/armor.sql b/data/armor.sql index ce85307..94655a0 100644 --- a/data/armor.sql +++ b/data/armor.sql @@ -64,7 +64,7 @@ VALUES -- TODO INSERT into armor_traits table -INSERT INTO armor_traits (armor_id, traits_id) +INSERT INTO armor_traits (armor_id, trait_id) VALUES (2, 88), -- explorer's clothing and comfort (3, 88), -- padded and comfort diff --git a/data/traits.sql b/data/traits.sql index 44a84e8..d3ed494 100644 --- a/data/traits.sql +++ b/data/traits.sql @@ -28,7 +28,7 @@ VALUES (14, 'Tradition'), (15, 'Weapon'); -INSERT INTO traits (trait_id, traittype, short_name,description) +INSERT INTO traits (trait_id, traittype, short_name, description) VALUES -- CRB and Monster Manual diff --git a/schema/ancestries.sql b/schema/ancestries.sql index ef407bf..108cef8 100644 --- a/schema/ancestries.sql +++ b/schema/ancestries.sql @@ -66,7 +66,7 @@ CREATE TABLE heritages_traits ( id INTEGER PRIMARY KEY, heritage_id INTEGER NOT NULL, trait_id INTEGER NOT NULL, - UNIQUE(heritage_id, trait_id), + -- UNIQUE(heritage_id, trait_id), FOREIGN KEY (heritage_id) REFERENCES heritages(heritage_id), FOREIGN KEY (trait_id) REFERENCES traits(trait_id) ); diff --git a/schema/armor.sql b/schema/armor.sql index 6185163..4ad3ed1 100644 --- a/schema/armor.sql +++ b/schema/armor.sql @@ -38,9 +38,9 @@ CREATE TABLE armor ( CREATE TABLE armor_traits ( id INTEGER PRIMARY KEY, armor_id INTEGER NOT NULL, - traits_id INTEGER NOT NULL, + trait_id INTEGER NOT NULL, FOREIGN KEY (armor_id) REFERENCES armor(armor_id), - FOREIGN KEY (traits_id) REFERENCES traits(traits_id) + FOREIGN KEY (trait_id) REFERENCES traits(trait_id) ); diff --git a/schema/spells.sql b/schema/spells.sql index ebfc293..a2af84b 100644 --- a/schema/spells.sql +++ b/schema/spells.sql @@ -67,9 +67,9 @@ CREATE TABLE spells_spellcomponents( CREATE TABLE spells_traits ( id INTEGER PRIMARY KEY, spells_id INTEGER NOT NULL, - traits_id INTEGER NOT NULL, - UNIQUE(spells_id, traits_id), + trait_id INTEGER NOT NULL, + UNIQUE(spells_id, trait_id), FOREIGN KEY (spells_id) REFERENCES spells(spells_id), - FOREIGN KEY (traits_id) REFERENCES traits(traits_id) + FOREIGN KEY (trait_id) REFERENCES traits(trait_id) ); diff --git a/schema/traits.sql b/schema/traits.sql index d3c99ad..58ca539 100644 --- a/schema/traits.sql +++ b/schema/traits.sql @@ -12,6 +12,6 @@ CREATE TABLE traits ( traittype INTEGER, short_name TEXT NOT NULL, description TEXT NOT NULL, - FOREIGN KEY (traittype) REFERENCES traittypes(traittypes_id) + FOREIGN KEY (traittype) REFERENCES traittypes(traittype_id) );