refactor out senses and traits into separate schema files

merge-requests/15/head
James Miller 2019-08-06 15:25:14 -05:00
parent 801c4a9b11
commit 65f1425daf
4 changed files with 30 additions and 22 deletions

View File

@ -2,6 +2,10 @@ rm pf2.db
echo 'loading schema'
echo 'schema/abilityscores.sql'
sqlite3 pf2.db < schema/abilityscores.sql
echo 'schema/traits.sql'
sqlite3 pf2.db < schema/traits.sql
echo 'schema/senses.sql'
sqlite3 pf2.db < schema/senses.sql
echo 'schema/ancestries.sql'
sqlite3 pf2.db < schema/ancestries.sql
echo 'loading data'

View File

@ -39,12 +39,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 +59,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 (

View File

@ -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
);

17
schema/traits.sql 100644
View File

@ -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)
);