2019-08-23 20:58:32 -04:00
|
|
|
-- -*- mode:sql sql-product:sqlite -*-
|
|
|
|
|
2019-08-29 16:14:21 -04:00
|
|
|
-- Parent table -- Table for Staves --
|
2019-08-23 20:58:32 -04:00
|
|
|
CREATE TABLE staff (
|
2019-08-30 13:15:56 -04:00
|
|
|
staff_id INTEGER PRIMARY KEY,
|
2019-08-23 20:58:32 -04:00
|
|
|
"name" TEXT NOT NULL UNIQUE, -- every staff should have a name --
|
|
|
|
"level" INTEGER NOT NULL, -- every staff should have a level --
|
2019-08-29 20:10:19 -04:00
|
|
|
price INTEGER, /* stored in GP
|
|
|
|
could add NOT NULL and store 0s */
|
2019-08-23 20:58:32 -04:00
|
|
|
bulk INTEGER, -- could add NOT NULL and store 0s --
|
2019-08-29 20:10:19 -04:00
|
|
|
usage TEXT, /* always "held in 1 hand"
|
|
|
|
Consider storing in another table */
|
2019-08-29 15:08:58 -04:00
|
|
|
item_bonus INTEGER, -- If the staff gives an item bonus --
|
2019-08-23 20:58:32 -04:00
|
|
|
craft_requirements TEXT, -- "Supply one casting of all listed levels of all listed spells." --
|
|
|
|
-- Consider storing in another table --
|
|
|
|
source_id INTEGER NOT NULL,
|
|
|
|
source_pages INTEGER NOT NULL,
|
|
|
|
"description" TEXT,
|
|
|
|
FOREIGN KEY (source_id) REFERENCES sources(sources_id)
|
|
|
|
);
|
|
|
|
|
2019-08-30 13:15:56 -04:00
|
|
|
-- Child table -- many-to-many --
|
|
|
|
CREATE TABLE staffactivations (
|
|
|
|
staffactivations_id INTEGER PRIMARY KEY,
|
|
|
|
"activation" TEXT NOT NULL,
|
|
|
|
effect TEXT NOT NULL
|
2019-08-29 16:14:21 -04:00
|
|
|
);
|
|
|
|
|
2019-08-30 13:15:56 -04:00
|
|
|
-- Joining table --
|
|
|
|
CREATE TABLE staff_staffactivations (
|
|
|
|
staff_id INTEGER,
|
|
|
|
staffactivations_id INTEGER,
|
2019-09-03 12:23:31 -04:00
|
|
|
PRIMARY KEY (staff_id, staffactivations_id),
|
2019-08-30 13:15:56 -04:00
|
|
|
FOREIGN KEY (staff_id) REFERENCES staff(staff_id),
|
|
|
|
FOREIGN KEY (staffactivations_id) REFERENCES staffactivations(staffactivations_id)
|
2019-08-29 17:34:39 -04:00
|
|
|
);
|
|
|
|
|
2019-08-30 13:15:56 -04:00
|
|
|
-- Joining table --
|
2019-08-29 17:34:39 -04:00
|
|
|
CREATE TABLE staff_trait (
|
2019-08-30 13:15:56 -04:00
|
|
|
staff_id INTEGER,
|
|
|
|
trait_id INTEGER,
|
2019-09-03 12:23:31 -04:00
|
|
|
PRIMARY KEY (staff_id, trait_id),
|
2019-08-29 20:10:19 -04:00
|
|
|
FOREIGN KEY (staff_id) REFERENCES staff(staff_id),
|
2019-08-29 17:34:39 -04:00
|
|
|
FOREIGN KEY (trait_id) REFERENCES traits(trait_id)
|
2019-08-30 13:15:56 -04:00
|
|
|
);
|
|
|
|
|
|
|
|
-- Joining table --
|
|
|
|
CREATE TABLE staff_spell (
|
|
|
|
staff_id INTEGER,
|
|
|
|
"level" INTEGER NOT NULL, -- This represents the level of the spell in the staff where 0 = cantrip --
|
|
|
|
spell_id INTEGER,
|
|
|
|
PRIMARY KEY (staff_id, "level", spell_id),
|
|
|
|
FOREIGN KEY (staff_id) REFERENCES staff(staff_id),
|
|
|
|
FOREIGN KEY (spell_id) REFERENCES spells(spells_id)
|
2019-09-03 12:23:31 -04:00
|
|
|
);
|