add alternate schema to schema/sources

merge-requests/35/merge
James R Miller 2019-08-18 20:00:45 -05:00
parent c2ffbfb161
commit 2db7d56364
1 changed files with 19 additions and 0 deletions

View File

@ -14,3 +14,22 @@ CREATE TABLE sources (
first_party BOOLEAN NOT NULL,
ogl_copyright_block TEXT NOT NULL
);
CREATE TABLE sourceentries (
sourceentries_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,
monsters_id INTEGER NOT NULL,
sourceentries_id INTEGER NOT NULL,
FOREIGN KEY (monsters_id) REFERENCES monsters(monsters_id),
FOREIGN KEY (sourceentries_id_id) REFERENCES sourceentries_id(sourceentries_id_id)
);
-- TODO add in new many-to-many tables for the various things we want to have sources be listed this way