| 
									
										
										
										
											2019-08-02 23:01:38 -04:00
										 |  |  | -- -*- mode:sql sql-product:sqlite -*-
 | 
					
						
							| 
									
										
										
										
											2019-08-02 22:32:51 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  | 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,
 | 
					
						
							| 
									
										
										
										
											2019-08-02 23:14:58 -04:00
										 |  |  |   speed INTEGER NOT NULL,
 | 
					
						
							| 
									
										
										
										
											2019-08-02 22:32:51 -04:00
										 |  |  |   vision_id INTEGER NOT NULL,
 | 
					
						
							| 
									
										
										
										
											2019-08-06 22:21:18 -04:00
										 |  |  |   FOREIGN KEY (vision_id) REFERENCES senses(senses_id),
 | 
					
						
							| 
									
										
										
										
											2019-08-02 22:32:51 -04:00
										 |  |  |   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)
 | 
					
						
							|  |  |  | );
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-02 22:32:51 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* 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 */
 | 
					
						
							| 
									
										
										
										
											2019-08-02 22:32:51 -04:00
										 |  |  | CREATE TABLE heritages (
 | 
					
						
							|  |  |  |   heritage_id INTEGER PRIMARY KEY,
 | 
					
						
							|  |  |  |   short_name TEXT NOT NULL UNIQUE,
 | 
					
						
							|  |  |  |   description TEXT NOT NULL
 | 
					
						
							|  |  |  | );
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 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-06 00:03:25 -04:00
										 |  |  | /* TODO THIS TABLE IS LIKELY NOT NEEDED. THANKS WES! */
 | 
					
						
							| 
									
										
										
										
											2019-08-05 16:32:27 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-02 23:32:03 -04:00
										 |  |  | CREATE TABLE heritages_traits (
 | 
					
						
							|  |  |  |   id INTEGER PRIMARY KEY,
 | 
					
						
							|  |  |  |   heritage_id INTEGER NOT NULL,
 | 
					
						
							|  |  |  |   trait_id INTEGER NOT NULL,
 | 
					
						
							|  |  |  |   UNIQUE(heritage_id, trait_id),
 | 
					
						
							|  |  |  |   FOREIGN KEY (heritage_id) REFERENCES heritages(heritage_id),
 | 
					
						
							|  |  |  |   FOREIGN KEY (trait_id) REFERENCES traits(trait_id)
 | 
					
						
							|  |  |  | );
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* has partial data */
 | 
					
						
							| 
									
										
										
										
											2019-08-02 22:32:51 -04:00
										 |  |  | 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));
 | 
					
						
							| 
									
										
										
										
											2019-08-02 22:32:51 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 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-08-02 22:32:51 -04:00
										 |  |  | );
 |