From a50d0228240c9316c0d07130556f9d3942726ef9 Mon Sep 17 00:00:00 2001 From: James Miller Date: Thu, 8 Aug 2019 16:39:40 -0500 Subject: [PATCH] wip on spells schema and ancillary data --- data/spells.sql | 44 ++++++++++++++++++++++++++++++++++ schema/spells.sql | 61 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 data/spells.sql create mode 100644 schema/spells.sql diff --git a/data/spells.sql b/data/spells.sql new file mode 100644 index 0000000..9a037a9 --- /dev/null +++ b/data/spells.sql @@ -0,0 +1,44 @@ +INSERT INTO spelltypes ( + (1, 'Spell'), + (2, 'Cantrip'), + (3, 'Focus'), + (3, 'Ritual') +); + +INSERT INTO spellcomponents ( + spellcomponents_id, + name) +VALUES + (1, 'Material'), + (2, 'Verbal'), + (3, 'Somatic'), + (4, 'Focus'); + +INSERT INTO spelltraditions ( + spelltraditions_id, + name +) +VALUES + (1, 'Arcane'), + (2, 'Divine'), + (3, 'Occult'), + (4, 'Primal'); + +/* TODO fill in spellschool descriptions */ + +INSERT INTO spellschools ( + spellschools_id, + sources_id, + sources_pages, + name, + descr +) +VALUES + (1, 1, '297','Abjuration', 'TODO'), + (2, 1, '297','Conjuration', 'TODO'), + (3, 1, '297','Divination', 'TODO'), + (4, 1, '297','Enchantment', 'TODO'), + (5, 1, '298','Evocation', 'TODO'), + (6, 1, '298','Illusion', 'TODO'), + (7, 1, '298','Necromancy', 'TODO'), + (8, 1, '298','Transmutation', 'TODO'), diff --git a/schema/spells.sql b/schema/spells.sql new file mode 100644 index 0000000..156bdbd --- /dev/null +++ b/schema/spells.sql @@ -0,0 +1,61 @@ +-- -*- mode:sql sql-product:sqlite -*- + +CREATE TABLE spelltypes ( + spelltypes_id INTEGER PRIMARY KEY, + name TEXT NOT NULL UNIQUE +); + +CREATE TABLE spellcomponents ( + spellcomponents_id INTEGER PRIMARY KEY, + name TEXT NOT NULL UNIQUE +); + +CREATE TABLE spelltraditions ( + spelltraditions_id INTEGER PRIMARY KEY, + name TEXT NOT NULL UNIQUE +); + +CREATE TABLE spellschools ( + spellschools_id INTEGER PRIMARY KEY, + sources_id INTEGER NOT NULL, + sources_pages TEXT, + name TEXT NOT NULL UNIQUE, + descr TEXT NOT NULL, + FOREIGN KEY (sources_id) REFERENCES sources(sources_id) +); + + +CREATE TABLE spells ( + spells_id INTEGER PRIMARY KEY, + nethysurl TEXT, + name TEXT NOT NULL UNIQUE, + source TEXT, + level INTEGER NOT NULL, + has_trigger BOOLEAN NOT NULL, + trigger TEXT, + descr TEXT NOT NULL, + spelltypes_id INTEGER NOT NULL, + range_text TEXT, + range_ft INTEGER, + targets TEXT, + FOREIGN KEY (sources_id) REFERENCES sources(sources_id) + + FOREIGN KEY (spelltypes_id) REFERENCES spelltypes(spelltypes_id) +); + +CREATE TABLE spells_spellcomponents( + spells_id INTEGER NOT NULL, + spellcomponents_id INTEGER NOT NULL, + FOREIGN KEY (spells_id) REFERENCES spells(spells_id), + FOREIGN KEY (spellcomponents_id) REFERENCES spellcomponents(spellcomponents_id) +); + + +CREATE TABLE spells_traits ( + id INTEGER PRIMARY KEY, + spells_id INTEGER NOT NULL, + traits_id INTEGER NOT NULL, + FOREIGN KEY (spells_id) REFERENCES spells(spells_id), + FOREIGN KEY (traits_id) REFERENCES traits(traits_id) +); +