pathfinder-2-sqlite-MIRROR/schema/ancestries.sql

95 lines
3.0 KiB
MySQL
Raw Normal View History

2019-08-02 23:01:38 -04:00
-- -*- 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,
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,
2019-08-06 22:21:18 -04:00
FOREIGN KEY (vision_id) REFERENCES senses(senses_id),
FOREIGN KEY (size_id) REFERENCES sizes(size_id)
);
2019-08-06 00:03:25 -04:00
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.. */
2019-08-02 23:01:38 -04:00
/* has partial data */
CREATE TABLE heritages (
heritage_id INTEGER PRIMARY KEY,
short_name TEXT NOT NULL UNIQUE,
2019-08-11 14:21:47 -04:00
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)
);
2019-08-02 23:32:03 -04:00
/* 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),
2019-08-03 23:08:02 -04:00
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),
2019-08-03 23:08:02 -04:00
FOREIGN KEY (lang_id) REFERENCES langs(lang_id)
);
2019-09-04 19:51:43 -04:00
2019-09-06 15:47:33 -04:00
-- Joining table --
2019-09-04 19:51:43 -04:00
CREATE TABLE ancestries_sourceentries (
id INTEGER PRIMARY KEY
,ancestry_id INTEGER NOT NULL
,sourceentry_id INTEGER NOT NULL
2019-09-06 18:03:42 -04:00
,UNIQUE (id, actions_id, sourceentry_id)
2019-09-04 19:51:43 -04:00
,FOREIGN KEY (ancestry_id) REFERENCES ancestries(ancestry_id)
,FOREIGN KEY (sourceentry_id) REFERENCES sourceentries(sourceentry_id)
);