Add id PK columns for all tables, hard code all ids

merge-requests/36/head
Brian Haley 2019-09-03 13:19:23 -04:00
parent 068c2fb2b8
commit ffba67c155
2 changed files with 596 additions and 588 deletions

File diff suppressed because it is too large Load Diff

View File

@ -23,33 +23,38 @@ CREATE TABLE staff (
CREATE TABLE staffactivations ( CREATE TABLE staffactivations (
staffactivations_id INTEGER PRIMARY KEY, staffactivations_id INTEGER PRIMARY KEY,
"activation" TEXT NOT NULL, "activation" TEXT NOT NULL,
effect TEXT NOT NULL effect TEXT NOT NULL,
UNIQUE (staffactivations_id, "activation", effect)
); );
-- Joining table -- -- Joining table --
CREATE TABLE staff_staffactivations ( CREATE TABLE staff_staffactivations (
staff_id INTEGER, id INTEGER PRIMARY KEY
staffactivations_id INTEGER, staff_id INTEGER NOT NULL,
PRIMARY KEY (staff_id, staffactivations_id), staffactivations_id INTEGER NOT NULL,
UNIQUE (id, staff_id, staffactivations_id),
FOREIGN KEY (staff_id) REFERENCES staff(staff_id), FOREIGN KEY (staff_id) REFERENCES staff(staff_id),
FOREIGN KEY (staffactivations_id) REFERENCES staffactivations(staffactivations_id) FOREIGN KEY (staffactivations_id) REFERENCES staffactivations(staffactivations_id)
); );
-- Joining table -- -- Joining table --
CREATE TABLE staff_trait ( CREATE TABLE staff_trait (
staff_id INTEGER, id INTEGER PRIMARY KEY,
trait_id INTEGER, staff_id INTEGER NOT NULL,
PRIMARY KEY (staff_id, trait_id), trait_id INTEGER NOT NULL,
UNIQUE (id, staff_id, trait_id),
FOREIGN KEY (staff_id) REFERENCES staff(staff_id), FOREIGN KEY (staff_id) REFERENCES staff(staff_id),
FOREIGN KEY (trait_id) REFERENCES traits(trait_id) FOREIGN KEY (trait_id) REFERENCES traits(trait_id)
); );
-- Joining table -- -- Joining table --
CREATE TABLE staff_spell ( CREATE TABLE staff_spell (
staff_id INTEGER, id INTEGER PRIMARY KEY,
staff_id INTEGER NOT NULL,
"level" INTEGER NOT NULL, -- This represents the level of the spell in the staff where 0 = cantrip -- "level" INTEGER NOT NULL, -- This represents the level of the spell in the staff where 0 = cantrip --
spell_id INTEGER, spell_id INTEGER NOT NULL,
PRIMARY KEY (staff_id, "level", spell_id), UNIQUE (id, staff_id, "level", spell_id),
FOREIGN KEY (staff_id) REFERENCES staff(staff_id), FOREIGN KEY (staff_id) REFERENCES staff(staff_id),
FOREIGN KEY (spell_id) REFERENCES spells(spells_id) FOREIGN KEY (spell_id) REFERENCES spells(spells_id)
); );