Merge branch 'refactor-schema'
commit
130b6e3e8a
|
@ -1,9 +1,9 @@
|
|||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
INSERT INTO sizes (size_id, short_name) VALUES
|
||||
(1, 'Tiny'),
|
||||
(2, 'Small'),
|
||||
(3, 'Medium'),
|
||||
(4, 'Large'),
|
||||
(5, 'Huge'),
|
||||
(6, 'Gargantuan');
|
||||
INSERT INTO sizes (size_id, short_name, space_in_ft, reach_tall_ft, reach_long_ft) VALUES
|
||||
(1,'Tiny',4,0,0),
|
||||
(2,'Small',5,5,5),
|
||||
(3,'Medium',5,5,5),
|
||||
(4,'Large',10,10,5),
|
||||
(5,'Huge',15,15,10),
|
||||
(6,'Gargantuan',20,20,15);
|
||||
|
|
|
@ -3,6 +3,10 @@ del pf2.db
|
|||
|
||||
:: Loading schema
|
||||
sqlite3 pf2.db < schema/abilityscores.sql
|
||||
sqlite3 pf2.db < schema/langs.sql
|
||||
sqlite3 pf2.db < schema/traits.sql
|
||||
sqlite3 pf2.db < schema/feats.sql
|
||||
sqlite3 pf2.db < schema/senses.sql
|
||||
sqlite3 pf2.db < schema/ancestries.sql
|
||||
|
||||
:: Loading data
|
||||
|
|
10
gendb.sh
10
gendb.sh
|
@ -2,6 +2,16 @@ rm pf2.db
|
|||
echo 'loading schema'
|
||||
echo 'schema/abilityscores.sql'
|
||||
sqlite3 pf2.db < schema/abilityscores.sql
|
||||
echo 'schema/sizes.sql'
|
||||
sqlite3 pf2.db < schema/sizes.sql
|
||||
echo 'schema/langs.sql'
|
||||
sqlite3 pf2.db < schema/langs.sql
|
||||
echo 'schema/traits.sql'
|
||||
sqlite3 pf2.db < schema/traits.sql
|
||||
echo 'schema/feats.sql'
|
||||
sqlite3 pf2.db < schema/feats.sql
|
||||
echo 'schema/senses.sql'
|
||||
sqlite3 pf2.db < schema/senses.sql
|
||||
echo 'schema/ancestries.sql'
|
||||
sqlite3 pf2.db < schema/ancestries.sql
|
||||
echo 'loading data'
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
-- -*- 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,
|
||||
|
@ -39,12 +36,6 @@ CREATE TABLE ancestries_flaws (
|
|||
FOREIGN KEY (abilityscores_id) REFERENCES abilityscores(abilityscores_id)
|
||||
);
|
||||
|
||||
/* has partial data */
|
||||
CREATE TABLE visions (
|
||||
vision_id INTEGER PRIMARY KEY,
|
||||
short_name TEXT NOT NULL UNIQUE,
|
||||
description TEXT NOT NULL
|
||||
);
|
||||
|
||||
/* Need to figure out how to model heritages that also have reactions / feats
|
||||
etc.. */
|
||||
|
@ -65,22 +56,6 @@ CREATE TABLE ancestries_heritages (
|
|||
FOREIGN KEY (heritage_id) REFERENCES heritages(heritage_id)
|
||||
);
|
||||
|
||||
/* TODO can the description var be UNIQUE? */
|
||||
/* has partial data done */
|
||||
CREATE TABLE traits (
|
||||
trait_id INTEGER PRIMARY KEY,
|
||||
-- short_name TEXT NOT NULL UNIQUE,
|
||||
traittype INTEGER,
|
||||
short_name TEXT NOT NULL,
|
||||
description TEXT NOT NULL,
|
||||
FOREIGN KEY (traittype) REFERENCES traittypes(traittypes_id)
|
||||
);
|
||||
|
||||
CREATE TABLE traittypes (
|
||||
traittype_id INTEGER PRIMARY KEY,
|
||||
name TEXT NOT NULL
|
||||
);
|
||||
|
||||
/* TODO THIS TABLE IS LIKELY NOT NEEDED. THANKS WES! */
|
||||
|
||||
CREATE TABLE heritages_traits (
|
||||
|
@ -102,16 +77,6 @@ CREATE TABLE ancestries_traits (
|
|||
FOREIGN KEY (trait_id) REFERENCES traits(trait_id)
|
||||
);
|
||||
|
||||
CREATE TABLE sizes (
|
||||
size_id INTEGER PRIMARY KEY,
|
||||
short_name TEXT NOT NULL UNIQUE
|
||||
);
|
||||
|
||||
CREATE TABLE langs (
|
||||
lang_id INTEGER PRIMARY KEY,
|
||||
short_name TEXT NOT NULL UNIQUE
|
||||
);
|
||||
|
||||
CREATE TABLE ancestries_langs (
|
||||
id INTEGER PRIMARY KEY,
|
||||
ancestry_id INTEGER NOT NULL,
|
||||
|
@ -119,7 +84,6 @@ CREATE TABLE ancestries_langs (
|
|||
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,
|
||||
|
@ -127,24 +91,3 @@ CREATE TABLE ancestry_additionalangs (
|
|||
FOREIGN KEY (ancestry_id) REFERENCES ancestries(ancestry_id),
|
||||
FOREIGN KEY (lang_id) REFERENCES langs(lang_id)
|
||||
);
|
||||
|
||||
/* Need to rethink how to model the various prerequisites */
|
||||
|
||||
CREATE TABLE feats (
|
||||
feat_id INTEGER PRIMARY KEY,
|
||||
short_name TEXT NOT NULL UNIQUE,
|
||||
prereq_feats INTEGER,
|
||||
prereq_ability_scores INTEGER,
|
||||
prereq_proficiency_ranks INTEGER,
|
||||
frequency TEXT,
|
||||
triggers TEXT,
|
||||
reqs TEXT
|
||||
);
|
||||
|
||||
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,24 @@
|
|||
-- -*- 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,
|
||||
short_name TEXT NOT NULL UNIQUE,
|
||||
prereq_feats INTEGER,
|
||||
prereq_ability_scores INTEGER,
|
||||
prereq_proficiency_ranks INTEGER,
|
||||
frequency TEXT,
|
||||
triggers TEXT,
|
||||
reqs TEXT
|
||||
);
|
||||
|
||||
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 langs (
|
||||
lang_id INTEGER PRIMARY KEY,
|
||||
short_name TEXT NOT NULL UNIQUE
|
||||
);
|
|
@ -0,0 +1,9 @@
|
|||
-- -*- mode:sql sql-product:sqlite -*-
|
||||
|
||||
/* TODO change visions to a senses table */
|
||||
|
||||
CREATE TABLE visions (
|
||||
vision_id INTEGER PRIMARY KEY,
|
||||
short_name TEXT NOT NULL UNIQUE,
|
||||
description TEXT NOT NULL
|
||||
);
|
|
@ -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,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(traittypes_id)
|
||||
);
|
||||
|
Loading…
Reference in New Issue