-- -*- 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,
);

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