2019-08-08 17:39:40 -04:00
-- -*- 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 )
) ;
2019-08-08 21:39:36 -04:00
-- TODO eventually once data is finalized, lock down variables as NOT NULL /
-- UNIQUE as sanity requires :)
2019-08-08 17:39:40 -04:00
CREATE TABLE spells (
spells_id INTEGER PRIMARY KEY ,
2019-08-08 22:42:57 -04:00
sources_id INTEGER NOT NULL , -- generated in spells.py from scraped data
sources_pages TEXT , -- generated in spells.py from scraped data
2019-08-08 22:01:12 -04:00
name TEXT NOT NULL UNIQUE , -- scraped from github repo
level INTEGER , -- scraped from github repo
2019-08-10 16:13:24 -04:00
trigger TEXT , -- scraped from spells.py NOTE, there are no duplicate triggers as of CRB, so not bothering with a separate spell triggers table at this time
2019-08-08 22:01:12 -04:00
descr TEXT , -- scraped from github repo
2019-08-08 22:53:43 -04:00
spelltypes_id INTEGER , -- generated from spells.py
2019-08-08 22:01:12 -04:00
range_text TEXT , -- scraped from github repo
range_ft INTEGER , -- generated from text in spells.py
targets TEXT , -- TODO in spells.py
nethysurl TEXT , -- scraped from github repo
2019-08-08 18:30:13 -04:00
FOREIGN KEY ( sources_id ) REFERENCES sources ( sources_id ) ,
2019-08-08 17:39:40 -04:00
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 ,
2019-08-08 22:42:57 -04:00
UNIQUE ( spells_id , traits_id ) ,
2019-08-08 17:39:40 -04:00
FOREIGN KEY ( spells_id ) REFERENCES spells ( spells_id ) ,
FOREIGN KEY ( traits_id ) REFERENCES traits ( traits_id )
) ;