mirror of
https://gitlab.com/jrmiller82/pathfinder-2-sqlite.git
synced 2026-10-12 22:29:44 -04:00
MAJOR DIRECTORY OVERHAUL
This commit is contained in:
1 parent
71ed03b165
commit
34ef5a6025
138 files changed
+48
-6
No files matched your search
@@ -0,0 +1,8 @@
|
||||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
CREATE TABLE abilityscores (
|
||||
abilityscores_id INTEGER PRIMARY KEY,
|
||||
flag_rep INTEGER NOT NULL,
|
||||
short_name TEXT NOT NULL UNIQUE,
|
||||
long_name TEXT NOT NULL UNIQUE
|
||||
);
|
||||
@@ -0,0 +1,38 @@
|
||||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
CREATE TABLE actioncosts (
|
||||
actioncosts_id INTEGER PRIMARY KEY,
|
||||
name TEXT NOT NULL UNIQUE,
|
||||
abbr TEXT NOT NULL UNIQUE
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE actioncategories (
|
||||
actioncategories_id INTEGER PRIMARY KEY,
|
||||
sources_id INTEGER NOT NULL,
|
||||
sources_pages TEXT NOT NULL,
|
||||
name TEXT NOT NULL UNIQUE,
|
||||
descr TEXT NOT NULL UNIQUE,
|
||||
FOREIGN KEY (sources_id) REFERENCES sources(sources_id)
|
||||
);
|
||||
|
||||
CREATE TABLE actions (
|
||||
actions_id INTEGER PRIMARY KEY,
|
||||
sources_id INTEGER NOT NULL,
|
||||
sources_pages TEXT NOT NULL,
|
||||
actioncategories_id INTEGER NOT NULL,
|
||||
actioncosts_id INTEGER,
|
||||
name TEXT NOT NULL UNIQUE,
|
||||
req TEXT,
|
||||
trigger TEXT,
|
||||
descr TEXT NOT NULL,
|
||||
FOREIGN KEY (actioncategories_id) REFERENCES actioncategories(actioncategories_id),
|
||||
FOREIGN KEY (actioncosts_id) REFERENCES actioncosts(actioncosts_id),
|
||||
FOREIGN KEY (sources_id) REFERENCES sources(sources_id)
|
||||
);
|
||||
|
||||
CREATE TABLE actions_traits (
|
||||
id INTEGER PRIMARY KEY,
|
||||
actions_id INTEGER NOT NULL,
|
||||
traits_id INTEGER NOT NULL
|
||||
);
|
||||
@@ -0,0 +1,9 @@
|
||||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
PRAGMA foreign_keys = ON;
|
||||
|
||||
CREATE TABLE alignments (
|
||||
alignments_id INTEGER PRIMARY KEY,
|
||||
"name" TEXT UNIQUE NOT NULL, -- 'Lawful Good'
|
||||
abbr TEXT UNIQUE NOT NULL -- 'LG'
|
||||
);
|
||||
@@ -0,0 +1,16 @@
|
||||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
PRAGMA foreign_keys = ON; -- database requires foreign key checking to be turned
|
||||
-- on PER CONNECTION
|
||||
|
||||
CREATE TABLE ammunition (
|
||||
ammunition_id INTEGER PRIMARY KEY,
|
||||
sources_id INTEGER,
|
||||
sources_pages TEXT,
|
||||
"name" TEXT NOT NULL UNIQUE,
|
||||
price_gp REAL,
|
||||
amount INTEGER,
|
||||
bulk REAL,
|
||||
descr TEXT,
|
||||
FOREIGN KEY (sources_id) REFERENCES sources(sources_id)
|
||||
)
|
||||
@@ -0,0 +1,87 @@
|
||||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
/*
|
||||
TODO Need to decide on whether to do a massive feats table, or to split feats
|
||||
into separate tables for general feats, ancestry feats, background feats, etc...
|
||||
|
||||
I think one big feat table that has a feat type in it and then an ancestry_feat
|
||||
table that matches feats to ancestries, etc..
|
||||
*/
|
||||
|
||||
CREATE TABLE ancestries (
|
||||
ancestry_id INTEGER PRIMARY KEY,
|
||||
sources_id INTEGER NOT NULL,
|
||||
sources_pages TEXT,
|
||||
short_name TEXT NOT NULL UNIQUE,
|
||||
flavor_text TEXT NOT NULL,
|
||||
hp INTEGER NOT NULL,
|
||||
size_id INTEGER NOT NULL,
|
||||
speed INTEGER NOT NULL,
|
||||
vision_id INTEGER NOT NULL,
|
||||
FOREIGN KEY (vision_id) REFERENCES senses(senses_id),
|
||||
FOREIGN KEY (size_id) REFERENCES sizes(size_id)
|
||||
);
|
||||
|
||||
CREATE TABLE ancestries_boosts (
|
||||
anc_boosts_id INTEGER PRIMARY KEY,
|
||||
ancestry_id INTEGER NOT NULL,
|
||||
abilityscores_id INTEGER NOT NULL,
|
||||
FOREIGN KEY (ancestry_id) REFERENCES ancestries(ancestry_id),
|
||||
FOREIGN KEY (abilityscores_id) REFERENCES abilityscores(abilityscores_id)
|
||||
);
|
||||
|
||||
CREATE TABLE ancestries_flaws (
|
||||
anc_flaws_id INTEGER PRIMARY KEY,
|
||||
ancestry_id INTEGER NOT NULL,
|
||||
abilityscores_id INTEGER NOT NULL,
|
||||
FOREIGN KEY (ancestry_id) REFERENCES ancestries(ancestry_id),
|
||||
FOREIGN KEY (abilityscores_id) REFERENCES abilityscores(abilityscores_id)
|
||||
);
|
||||
|
||||
|
||||
/* Need to figure out how to model heritages that also have reactions / feats
|
||||
etc.. */
|
||||
|
||||
/* has partial data */
|
||||
CREATE TABLE heritages (
|
||||
heritage_id INTEGER PRIMARY KEY,
|
||||
short_name TEXT NOT NULL UNIQUE,
|
||||
description TEXT NOT NULL,
|
||||
bonus_type TEXT, -- TODO Should this be text, or should this have its own table and FK?
|
||||
bonus_id INTEGER -- TODO What is this referencing from data/heritages.sql ???
|
||||
);
|
||||
|
||||
CREATE TABLE ancestries_heritages (
|
||||
id INTEGER PRIMARY KEY,
|
||||
ancestry_id INTEGER NOT NULL,
|
||||
heritage_id INTEGER NOT NULL,
|
||||
UNIQUE(ancestry_id, heritage_id),
|
||||
FOREIGN KEY (ancestry_id) REFERENCES ancestries(ancestry_id),
|
||||
FOREIGN KEY (heritage_id) REFERENCES heritages(heritage_id)
|
||||
);
|
||||
|
||||
|
||||
/* has partial data */
|
||||
CREATE TABLE ancestries_traits (
|
||||
id INTEGER PRIMARY KEY,
|
||||
ancestry_id INTEGER NOT NULL,
|
||||
trait_id INTEGER NOT NULL,
|
||||
UNIQUE(ancestry_id, trait_id),
|
||||
FOREIGN KEY (ancestry_id) REFERENCES ancestries(ancestry_id),
|
||||
FOREIGN KEY (trait_id) REFERENCES traits(trait_id)
|
||||
);
|
||||
|
||||
CREATE TABLE ancestries_langs (
|
||||
id INTEGER PRIMARY KEY,
|
||||
ancestry_id INTEGER NOT NULL,
|
||||
lang_id INTEGER NOT NULL,
|
||||
FOREIGN KEY (ancestry_id) REFERENCES ancestries(ancestry_id),
|
||||
FOREIGN KEY (lang_id) REFERENCES langs(lang_id));
|
||||
|
||||
CREATE TABLE ancestry_additionalangs (
|
||||
id INTEGER PRIMARY KEY,
|
||||
ancestry_id INTEGER NOT NULL,
|
||||
lang_id INTEGER NOT NULL,
|
||||
FOREIGN KEY (ancestry_id) REFERENCES ancestries(ancestry_id),
|
||||
FOREIGN KEY (lang_id) REFERENCES langs(lang_id)
|
||||
);
|
||||
@@ -0,0 +1,46 @@
|
||||
|
||||
CREATE TABLE armorgroup (
|
||||
grp_id INTEGER PRIMARY KEY,
|
||||
sources_id INTEGER NOT NULL,
|
||||
sources_pages TEXT NOT NULL,
|
||||
short_name TEXT NOT NULL UNIQUE,
|
||||
descr TEXT NOT NULL,
|
||||
FOREIGN KEY (sources_id) REFERENCES sources(sources_id)
|
||||
);
|
||||
|
||||
CREATE TABLE armorcategory (
|
||||
armor_category_id INTEGER PRIMARY KEY,
|
||||
short_name TEXT NOT NULL UNIQUE
|
||||
);
|
||||
|
||||
CREATE TABLE armor (
|
||||
armor_id INTEGER PRIMARY KEY,
|
||||
sources_id INTEGER NOT NULL,
|
||||
sources_pages TEXT,
|
||||
armor_category_id INTEGER NOT NULL,
|
||||
short_name TEXT NOT NULL,
|
||||
item_level INTEGER,
|
||||
price_text TEXT NOT NULL,
|
||||
price_gp FLOAT NOT NULL,
|
||||
ac_bonus INTEGER NOT NULL,
|
||||
dex_cap INTEGER,
|
||||
check_penalty INTEGER,
|
||||
speed_penalty INTEGER,
|
||||
strength INTEGER,
|
||||
bulk_id INTEGER NOT NULL,
|
||||
grp_id INTEGER,
|
||||
descr TEXT NOT NULL,
|
||||
FOREIGN KEY (bulk_id) REFERENCES bulks(bulk_id),
|
||||
FOREIGN KEY (grp_id) REFERENCES armorgroup(grp_id),
|
||||
FOREIGN KEY (sources_id) REFERENCES sources(sources_id)
|
||||
);
|
||||
|
||||
CREATE TABLE armor_traits (
|
||||
id INTEGER PRIMARY KEY,
|
||||
armor_id INTEGER NOT NULL,
|
||||
trait_id INTEGER NOT NULL,
|
||||
FOREIGN KEY (armor_id) REFERENCES armor(armor_id),
|
||||
FOREIGN KEY (trait_id) REFERENCES traits(trait_id)
|
||||
);
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
CREATE TABLE backgrounds (
|
||||
bg_id INTEGER PRIMARY KEY,
|
||||
"name" TEXT NOT NULL UNIQUE,
|
||||
descr TEXT NOT NULL,
|
||||
sources_id INTEGER NOT NULL,
|
||||
sources_pages TEXT NOT NULL,
|
||||
is_comty_use BOOLEAN NOT NULL, -- false = no community use policy required
|
||||
is_specific_to_adv BOOLEAN NOT NULL, -- means the background is specific to its adventure
|
||||
FOREIGN KEY (sources_id) REFERENCES sources(sources_id)
|
||||
);
|
||||
@@ -0,0 +1,10 @@
|
||||
CREATE TABLE bulks (
|
||||
bulk_id INTEGER PRIMARY KEY,
|
||||
sources_id INTEGER NOT NULL,
|
||||
sources_pages TEXT NOT NULL,
|
||||
short_name TEXT NOT NULL,
|
||||
long_name TEXT NOT NULL,
|
||||
numerical FLOAT NOT NULL,
|
||||
FOREIGN KEY (sources_id) REFERENCES sources(sources_id)
|
||||
);
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
CREATE TABLE conditions (
|
||||
conditions_id INTEGER PRIMARY KEY,
|
||||
name TEXT UNIQUE NOT NULL,
|
||||
short_descr TEXT NOT NULL,
|
||||
descr TEXT NOT NULL,
|
||||
sources_id INTEGER NOT NULL,
|
||||
sources_pages TEXT,
|
||||
FOREIGN KEY (sources_id) REFERENCES sources(sources_id)
|
||||
);
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
-- CREATE TABLE abilityscores (
|
||||
-- abilityscores_id INTEGER PRIMARY KEY,
|
||||
-- flag_rep INTEGER NOT NULL,
|
||||
-- short_name TEXT NOT NULL UNIQUE,
|
||||
-- long_name TEXT NOT NULL UNIQUE
|
||||
-- );
|
||||
|
||||
|
||||
CREATE TABLE damagecategories (
|
||||
damagecategories_id INTEGER PRIMARY KEY,
|
||||
sources_id INTEGER,
|
||||
sources_pages TEXT,
|
||||
"name" TEXT NOT NULL UNIQUE,
|
||||
descr TEXT,
|
||||
FOREIGN KEY (sources_id) REFERENCES sources(sources_id)
|
||||
);
|
||||
|
||||
CREATE TABLE damagetypes (
|
||||
damagetypes_id INTEGER PRIMARY KEY,
|
||||
sources_id INTEGER,
|
||||
sources_pages TEXT,
|
||||
damagecategories_id INTEGER NOT NULL,
|
||||
"abbr" TEXT,
|
||||
"name" TEXT NOT NULL UNIQUE,
|
||||
FOREIGN KEY (damagecategories_id) REFERENCES damagecategories(damagecategories_id),
|
||||
FOREIGN KEY (sources_id) REFERENCES sources(sources_id)
|
||||
);
|
||||
@@ -0,0 +1,47 @@
|
||||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
/* MUST BE CALLED AFTER TRAITS TABLE IS FORMED */
|
||||
|
||||
/* Need to rethink how to model the various prerequisites */
|
||||
|
||||
|
||||
CREATE TABLE feats (
|
||||
feat_id INTEGER PRIMARY KEY,
|
||||
sources_id INTEGER NOT NULL,
|
||||
sources_pages TEXT NOT NULL,
|
||||
short_name TEXT NOT NULL UNIQUE,
|
||||
descr TEXT NOT NULL,
|
||||
action_id INTEGER,
|
||||
frequency_id INTEGER,
|
||||
triggers_id INTEGER,
|
||||
requirements_id INTEGER,
|
||||
FOREIGN KEY (sources_id) REFERENCES sources(sources_id),
|
||||
FOREIGN KEY (action_id) REFERENCES actioncosts(actioncosts_id),
|
||||
FOREIGN KEY (frequency_id) REFERENCES frequency(freq_id),
|
||||
FOREIGN KEY (triggers_id) REFERENCES triggers(triggers_id),
|
||||
FOREIGN KEY (requirements_id) REFERENCES requirements(requirements_id)
|
||||
);
|
||||
|
||||
CREATE TABLE featprereqs (
|
||||
featprereqs_id INTEGER PRIMARY KEY,
|
||||
descr TEXT NOT NULL UNIQUE,
|
||||
feat_id INTEGER, -- this can be NULL since not all prereqs are feats
|
||||
FOREIGN KEY (feat_id) REFERENCES feats(feat_id)
|
||||
);
|
||||
|
||||
CREATE TABLE feats_featprereqs (
|
||||
id INTEGER PRIMARY KEY,
|
||||
feat_id INTEGER NOT NULL,
|
||||
featprereqs_id INTEGER NOT NULL,
|
||||
FOREIGN KEY (feat_id) REFERENCES feats(feat_id),
|
||||
FOREIGN KEY (featprereqs_id) REFERENCES featprereqs(featprereqs_id)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE feats_traits (
|
||||
id INTEGER PRIMARY KEY,
|
||||
feat_id INTEGER NOT NULL,
|
||||
trait_id INTEGER NOT NULL,
|
||||
FOREIGN KEY (feat_id) REFERENCES feats(feat_id),
|
||||
FOREIGN KEY (trait_id) REFERENCES traits(trait_id)
|
||||
);
|
||||
@@ -0,0 +1,6 @@
|
||||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
CREATE TABLE frequency (
|
||||
freq_id INTEGER PRIMARY KEY,
|
||||
freq_descr TEXT NOT NULL UNIQUE
|
||||
);
|
||||
@@ -0,0 +1,21 @@
|
||||
CREATE TABLE gear(
|
||||
"gear_id" INTEGER PRIMARY KEY,
|
||||
"name" TEXT NOT NULL UNIQUE,
|
||||
"level" INTEGER,
|
||||
"price" REAL,
|
||||
"bulk" REAL,
|
||||
"hands" INTEGER,
|
||||
"sources_id" INTEGER,
|
||||
"sources_pages" TEXT,
|
||||
"descr" TEXT NOT NULL,
|
||||
FOREIGN KEY (sources_id) REFERENCES sources(sources_id)
|
||||
);
|
||||
|
||||
CREATE TABLE gear_traits(
|
||||
id INTEGER PRIMARY KEY,
|
||||
gear_id INTEGER NOT NULL,
|
||||
trait_id INTEGER NOT NULL,
|
||||
FOREIGN KEY (gear_id) REFERENCES gear(gear_id),
|
||||
FOREIGN KEY (trait_id) REFERENCES traits(trait_id)
|
||||
);
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
CREATE TABLE langsrarity (
|
||||
rarity_id INTEGER PRIMARY KEY,
|
||||
rarity_name TEXT NOT NULL UNIQUE
|
||||
);
|
||||
|
||||
CREATE TABLE langs (
|
||||
lang_id INTEGER PRIMARY KEY,
|
||||
lang TEXT NOT NULL UNIQUE,
|
||||
speakers TEXT NOT NULL UNIQUE,
|
||||
rarity_id INTEGER NOT NULL,
|
||||
sources_id INTEGER NOT NULL,
|
||||
sources_pages TEXT NOT NULL,
|
||||
FOREIGN KEY (rarity_id) REFERENCES langsrarity(rarity_id),
|
||||
FOREIGN KEY (sources_id) REFERENCES sources(sources_id)
|
||||
);
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
PRAGMA foreign_keys = ON;
|
||||
|
||||
-- TODO needs data
|
||||
|
||||
-- Rarity will be by trait
|
||||
-- Monster 'type' will be by trait
|
||||
-- Monster category is also by trait
|
||||
|
||||
-- So the bestiary breaks down trait versus category or family, but then sticks
|
||||
-- them all in the trait position on the stat block, so I think we just do it
|
||||
-- all with traits. Thoughts?
|
||||
|
||||
CREATE TABLE monsters (
|
||||
monster_id INTEGER PRIMARY KEY,
|
||||
is_comty_use BOOLEAN NOT NULL, -- false = no community use policy req
|
||||
sourceentry_id INTEGER, -- new style source entries
|
||||
-- monstercategories_id INTEGER, -- Humanoid etc..
|
||||
"name" TEXT NOT NULL UNIQUE,
|
||||
"level" INTEGER,
|
||||
alignment_id INTEGER, -- i.e. NG, LE etc..
|
||||
perception INTEGER,
|
||||
size_id INTEGER, -- i.e. large medium small etc..
|
||||
ac INTEGER,
|
||||
fortitude INTEGER,
|
||||
reflex INTEGER,
|
||||
will INTEGER,
|
||||
hp INTEGER,
|
||||
land_speed INTEGER, -- we decided to make the speeds flattened as they don't
|
||||
-- save much extra space
|
||||
burrow_speed INTEGER,
|
||||
climb_speed INTEGER,
|
||||
fly_speed INTEGER,
|
||||
swim_speed INTEGER,
|
||||
str_mod INTEGER,
|
||||
dex_mod INTEGER,
|
||||
con_mod INTEGER,
|
||||
int_mod INTEGER,
|
||||
wis_mod INTEGER,
|
||||
cha_mod INTEGER,
|
||||
specific_monster_flavortext TEXT,
|
||||
FOREIGN KEY (alignment_id) REFERENCES alignments(alignments_id),
|
||||
FOREIGN KEY (size_id) REFERENCES sizes(size_id),
|
||||
FOREIGN KEY (sourceentry_id) REFERENCES sourceentries(sourceentry_id)
|
||||
);
|
||||
|
||||
CREATE TABLE monsterflavortexttypes (
|
||||
monsterflavortexttype_id INTEGER PRIMARY KEY,
|
||||
"name" TEXT NOT NULL UNIQUE
|
||||
-- page 7 Bestiary
|
||||
-- 'Monster Category' -- i.e. "Bear"
|
||||
-- THE FOLLOWING ARE THE SIDEBAR CONTENT FROM BESTIARY
|
||||
-- 'Advice and Rules'
|
||||
-- 'Related Creatures'
|
||||
-- 'Additional Lore'
|
||||
-- 'Treasure and Rewards'
|
||||
-- 'Locations'
|
||||
);
|
||||
|
||||
CREATE TABLE monsterflavortexts (
|
||||
monsterflavortext_id INTEGER PRIMARY KEY,
|
||||
monsterflavortexttype_id INTEGER,
|
||||
heading TEXT NOT NULL,
|
||||
mft_text TEXT NOT NULL,
|
||||
FOREIGN KEY (monsterflavortexttype_id) REFERENCES monsterflavortexttypes(monsterflavortexttype_id)
|
||||
);
|
||||
|
||||
CREATE TABLE monsters_monsterflavortexts (
|
||||
id INTEGER PRIMARY KEY,
|
||||
monster_id,
|
||||
monsterflavortext_id,
|
||||
FOREIGN KEY (monster_id) REFERENCES monsters(monster_id),
|
||||
FOREIGN KEY (monsterflavortext_id) REFERENCES monsterflavortexts(monsterflavortext_id)
|
||||
);
|
||||
|
||||
CREATE TABLE monsters_senses (
|
||||
id INTEGER PRIMARY KEY,
|
||||
monster_id INTEGER NOT NULL,
|
||||
sense_id INTEGER NOT NULL,
|
||||
FOREIGN KEY (monster_id) REFERENCES monsters(monster_id),
|
||||
FOREIGN KEY (sense_id) REFERENCES senses(senses_id)
|
||||
);
|
||||
|
||||
CREATE TABLE monsters_immunities (
|
||||
id INTEGER PRIMARY KEY,
|
||||
monsters_id INTEGER NOT NULL,
|
||||
immunities_id INTEGER NOT NULL,
|
||||
FOREIGN KEY (monsters_id) REFERENCES monsters(monsters_id),
|
||||
FOREIGN KEY (immunities_id) REFERENCES immunities(immunities_id)
|
||||
);
|
||||
|
||||
CREATE TABLE monsters_skills (
|
||||
id INTEGER PRIMARY KEY,
|
||||
monster_id INTEGER NOT NULL,
|
||||
skills_id INTEGER NOT NULL, -- will ID the specific skill
|
||||
skill_mod INTEGER NOT NULL, -- will hold the modifier value
|
||||
UNIQUE(monster_id, skills_id), -- so we don't get duplicate rows for a specific monster
|
||||
FOREIGN KEY (monster_id) REFERENCES monsters(monster_id),
|
||||
FOREIGN KEY (skills_id) REFERENCES skills(skills_id)
|
||||
);
|
||||
|
||||
CREATE TABLE monsters_traits (
|
||||
id INTEGER PRIMARY KEY,
|
||||
monster_id INTEGER NOT NULL,
|
||||
trait_id INTEGER NOT NULL,
|
||||
FOREIGN KEY (monster_id) REFERENCES monsters(monster_id),
|
||||
FOREIGN KEY (trait_id) REFERENCES traits(trait_id)
|
||||
);
|
||||
|
||||
CREATE TABLE monsters_langs (
|
||||
id INTEGER PRIMARY KEY,
|
||||
monster_id INTEGER NOT NULL,
|
||||
lang_id INTEGER NOT NULL,
|
||||
FOREIGN KEY (monster_id) REFERENCES monsters(monster_id),
|
||||
FOREIGN KEY (lang_id) REFERENCES langs(lang_id)
|
||||
);
|
||||
|
||||
CREATE TABLE monsteractions (
|
||||
monsteraction_id INTEGER PRIMARY KEY,
|
||||
"name" TEXT
|
||||
-- TODO
|
||||
);
|
||||
|
||||
CREATE TABLE monsters_actions (
|
||||
id INTEGER PRIMARY KEY,
|
||||
monster_id INTEGER NOT NULL,
|
||||
monsteraction_id INTEGER NOT NULL
|
||||
);
|
||||
@@ -0,0 +1,12 @@
|
||||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
PRAGMA foreign_keys = ON;
|
||||
|
||||
-- TODO needs data
|
||||
|
||||
CREATE TABLE movements (
|
||||
movements_id INTEGER PRIMARY KEY,
|
||||
"name" TEXT UNIQUE NOT NULL
|
||||
);
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
CREATE TABLE requirements (
|
||||
requirements_id INTEGER PRIMARY KEY,
|
||||
requirements_descr TEXT NOT NULL UNIQUE
|
||||
);
|
||||
@@ -0,0 +1,12 @@
|
||||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
/* TODO change visions to a senses table */
|
||||
|
||||
CREATE TABLE senses (
|
||||
senses_id INTEGER PRIMARY KEY,
|
||||
sources_id INTEGER,
|
||||
sources_pages TEXT,
|
||||
short_name TEXT NOT NULL UNIQUE,
|
||||
description TEXT,
|
||||
FOREIGN KEY (sources_id) REFERENCES sources(sources_id)
|
||||
);
|
||||
@@ -0,0 +1,10 @@
|
||||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
|
||||
CREATE TABLE sizes (
|
||||
size_id INTEGER PRIMARY KEY,
|
||||
short_name TEXT NOT NULL UNIQUE,
|
||||
space_in_ft INTEGER NOT NULL,
|
||||
reach_tall_ft INTEGER NOT NULL,
|
||||
reach_long_ft INTEGER NOT NULL
|
||||
);
|
||||
@@ -0,0 +1,12 @@
|
||||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
PRAGMA foreign_keys = ON;
|
||||
|
||||
CREATE TABLE skills (
|
||||
skills_id INTEGER PRIMARY KEY,
|
||||
sources_id INTEGER,
|
||||
sources_pages TEXT,
|
||||
"name" TEXT UNIQUE NOT NULL,
|
||||
descr TEXT,
|
||||
FOREIGN KEY (sources_id) REFERENCES sources(sources_id)
|
||||
);
|
||||
@@ -0,0 +1,35 @@
|
||||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
-- MUST BE CALLED EARLY IN SCRIPT
|
||||
|
||||
CREATE TABLE sources (
|
||||
sources_id INTEGER PRIMARY KEY,
|
||||
isbn TEXT,
|
||||
pzocode TEXT,
|
||||
sources_full_name TEXT NOT NULL UNIQUE,
|
||||
sources_short_name TEXT NOT NULL UNIQUE,
|
||||
sources_abbrev TEXT NOT NULL UNIQUE,
|
||||
sources_descr TEXT NOT NULL,
|
||||
release_date TEXT NOT NULL, -- in YYYY-MM-DD format
|
||||
first_party BOOLEAN NOT NULL,
|
||||
ogl_copyright_block TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE sourceentries (
|
||||
sourceentry_id INTEGER PRIMARY KEY,
|
||||
sources_id INTEGER NOT NULL,
|
||||
page_start INTEGER,
|
||||
page_stop INTEGER,
|
||||
UNIQUE (sources_id, page_start, page_stop), -- prevent duplicates
|
||||
FOREIGN KEY (sources_id) REFERENCES sources(sources_id)
|
||||
);
|
||||
|
||||
CREATE TABLE monsters_sourceentries (
|
||||
id INTEGER PRIMARY KEY,
|
||||
monster_id INTEGER NOT NULL,
|
||||
sourceentry_id INTEGER NOT NULL,
|
||||
FOREIGN KEY (monster_id) REFERENCES monsters(monster_id),
|
||||
FOREIGN KEY (sourceentry_id) REFERENCES sourceentries(sourceentry_id)
|
||||
);
|
||||
|
||||
-- TODO add in new many-to-many tables for the various things we want to have sources be listed this way
|
||||
@@ -0,0 +1,75 @@
|
||||
-- -*- 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 spelltargets (
|
||||
spelltargets_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)
|
||||
);
|
||||
|
||||
-- TODO eventually once data is finalized, lock down variables as NOT NULL /
|
||||
-- UNIQUE as sanity requires :)
|
||||
-- TODO Area eventually needs its own table
|
||||
CREATE TABLE spells (
|
||||
spells_id INTEGER PRIMARY KEY,
|
||||
sources_id INTEGER NOT NULL, -- generated in spells.py from scraped data
|
||||
sources_pages TEXT, -- generated in spells.py from scraped data
|
||||
"name" TEXT NOT NULL UNIQUE, -- scraped from github repo
|
||||
"level" INTEGER, -- scraped from github repo
|
||||
"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
|
||||
descr TEXT, -- scraped from github repo
|
||||
spelltypes_id INTEGER, -- generated from spells.py
|
||||
range_text TEXT, -- scraped from github repo
|
||||
range_ft INTEGER, -- generated from text in spells.py
|
||||
area_text TEXT, -- TODO need to figure out some sort of programmatic representation for this too
|
||||
spelltargets_id INTEGER,
|
||||
nethysurl TEXT, -- scraped from github repo
|
||||
actioncosts_id INTEGER,
|
||||
FOREIGN KEY (actioncosts_id) REFERENCES actioncosts(actioncosts_id),
|
||||
FOREIGN KEY (sources_id) REFERENCES sources(sources_id),
|
||||
FOREIGN KEY (spelltypes_id) REFERENCES spelltypes(spelltypes_id),
|
||||
FOREIGN KEY (spelltargets_id) REFERENCES spelltargets(spelltargets_id)
|
||||
);
|
||||
|
||||
CREATE TABLE spells_spellcomponents(
|
||||
id INTEGER PRIMARY KEY,
|
||||
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,
|
||||
trait_id INTEGER NOT NULL,
|
||||
UNIQUE(spells_id, trait_id),
|
||||
FOREIGN KEY (spells_id) REFERENCES spells(spells_id),
|
||||
FOREIGN KEY (trait_id) REFERENCES traits(trait_id)
|
||||
);
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
-- Parent table -- Table for Staves --
|
||||
CREATE TABLE staff (
|
||||
staff_id INTEGER PRIMARY KEY,
|
||||
"name" TEXT NOT NULL UNIQUE, -- every staff should have a name --
|
||||
"level" INTEGER NOT NULL, -- every staff should have a level --
|
||||
price INTEGER, /* stored in GP
|
||||
could add NOT NULL and store 0s */
|
||||
bulk INTEGER, -- could add NOT NULL and store 0s --
|
||||
usage TEXT, /* always "held in 1 hand"
|
||||
Consider storing in another table */
|
||||
item_bonus INTEGER, -- If the staff gives an item bonus --
|
||||
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)
|
||||
);
|
||||
|
||||
-- Child table -- many-to-many --
|
||||
CREATE TABLE staffactivations (
|
||||
staffactivations_id INTEGER PRIMARY KEY,
|
||||
"activation" TEXT NOT NULL,
|
||||
effect TEXT NOT NULL,
|
||||
UNIQUE (staffactivations_id, "activation", effect)
|
||||
);
|
||||
|
||||
-- Joining table --
|
||||
CREATE TABLE staff_staffactivations (
|
||||
id INTEGER PRIMARY KEY,
|
||||
staff_id INTEGER NOT NULL,
|
||||
staffactivations_id INTEGER NOT NULL,
|
||||
UNIQUE (id, staff_id, staffactivations_id),
|
||||
FOREIGN KEY (staff_id) REFERENCES staff(staff_id),
|
||||
FOREIGN KEY (staffactivations_id) REFERENCES staffactivations(staffactivations_id)
|
||||
);
|
||||
|
||||
-- Joining table --
|
||||
CREATE TABLE staff_trait (
|
||||
id INTEGER PRIMARY KEY,
|
||||
staff_id INTEGER NOT NULL,
|
||||
trait_id INTEGER NOT NULL,
|
||||
UNIQUE (id, staff_id, trait_id),
|
||||
FOREIGN KEY (staff_id) REFERENCES staff(staff_id),
|
||||
FOREIGN KEY (trait_id) REFERENCES traits(trait_id)
|
||||
);
|
||||
|
||||
-- Joining table --
|
||||
CREATE TABLE staff_spell (
|
||||
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 --
|
||||
spell_id INTEGER NOT NULL,
|
||||
UNIQUE (id, staff_id, "level", spell_id),
|
||||
FOREIGN KEY (staff_id) REFERENCES staff(staff_id),
|
||||
FOREIGN KEY (spell_id) REFERENCES spells(spells_id)
|
||||
);
|
||||
@@ -0,0 +1,17 @@
|
||||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
CREATE TABLE traittypes (
|
||||
traittype_id INTEGER PRIMARY KEY,
|
||||
name TEXT NOT NULL
|
||||
);
|
||||
|
||||
/* TODO can the description var be UNIQUE? */
|
||||
/* has partial data done */
|
||||
CREATE TABLE traits (
|
||||
trait_id INTEGER PRIMARY KEY,
|
||||
traittype INTEGER,
|
||||
short_name TEXT NOT NULL,
|
||||
description TEXT NOT NULL,
|
||||
FOREIGN KEY (traittype) REFERENCES traittypes(traittype_id)
|
||||
);
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
CREATE TABLE triggers (
|
||||
triggers_id INTEGER PRIMARY KEY,
|
||||
triggers_descr TEXT NOT NULL UNIQUE
|
||||
);
|
||||
@@ -0,0 +1,47 @@
|
||||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
PRAGMA foreign_keys = ON; -- database requires foreign key checking to be turned
|
||||
-- on PER CONNECTION
|
||||
|
||||
CREATE TABLE weapongroups (
|
||||
weapongroups_id INTEGER PRIMARY KEY,
|
||||
sources_id INTEGER,
|
||||
sources_pages TEXT,
|
||||
"name" TEXT NOT NULL UNIQUE,
|
||||
descr TEXT,
|
||||
FOREIGN KEY (sources_id) REFERENCES sources(sources_id)
|
||||
);
|
||||
|
||||
CREATE TABLE weaponcategories (
|
||||
weaponcategories_id INTEGER PRIMARY KEY,
|
||||
"name" TEXT NOT NULL UNIQUE
|
||||
);
|
||||
|
||||
CREATE TABLE weapons (
|
||||
weapons_id INTEGER PRIMARY KEY,
|
||||
sources_id INTEGER,
|
||||
sources_pages TEXT,
|
||||
weaponcategories_id INTEGER,
|
||||
weapongroups_id INTEGER,
|
||||
price_gp TEXT, --Text to fix the floating point error
|
||||
dice_size INTEGER,
|
||||
damagetypes_id INTEGER,
|
||||
"bulk" TEXT, --Text to fix the floating point error
|
||||
hands TEXT, -- '1+' is different than '1' per the rules
|
||||
range INTEGER,
|
||||
reload TEXT, -- '-' is significant in the rules
|
||||
"name" TEXT NOT NULL UNIQUE,
|
||||
descr TEXT,
|
||||
FOREIGN KEY (weapongroups_id) REFERENCES weapongroups(weapongroups_id),
|
||||
FOREIGN KEY (weaponcategories_id) REFERENCES weaponcategories(weaponcategories_id),
|
||||
FOREIGN KEY (sources_id) REFERENCES sources(sources_id)
|
||||
);
|
||||
|
||||
CREATE TABLE weapons_traits (
|
||||
id INTEGER PRIMARY KEY,
|
||||
weapons_id INTEGER NOT NULL,
|
||||
trait_id INTEGER NOT NULL,
|
||||
UNIQUE(weapons_id, trait_id)
|
||||
FOREIGN KEY (weapons_id) REFERENCES weapons(weapons_id),
|
||||
FOREIGN KEY (trait_id) REFERENCes traits(trait_id)
|
||||
);
|
||||
Reference in new issue
Block a user