19 lines
584 B
SQL
19 lines
584 B
SQL
-- -*- mode:sql sql-product:sqlite -*-
|
|
|
|
CREATE TABLE conditions (
|
|
conditions_id INTEGER PRIMARY KEY,
|
|
name TEXT UNIQUE NOT NULL,
|
|
short_descr TEXT NOT NULL,
|
|
descr TEXT NOT NULL,
|
|
FOREIGN KEY (sources_id) REFERENCES sources(sources_id)
|
|
);
|
|
|
|
-- Joining table --
|
|
CREATE TABLE conditions_sourceentries (
|
|
id INTEGER PRIMARY KEY
|
|
,conditions_id INTEGER NOT NULL
|
|
,sourceentry_id INTEGER NOT NULL
|
|
,UNIQUE (id, conditions_id, sourceentry_id)
|
|
,FOREIGN KEY (conditions_id) REFERENCES conditions(conditions_id)
|
|
,FOREIGN KEY (sourceentry_id) REFERENCES sourceentries(sourceentry_id)
|
|
); |