pi-hole/advanced/Templates/gravity.db.schema
DL6ER 93f1859bab
Store regex in gravity.db as well
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-02-03 15:13:18 +01:00

21 lines
894 B
Text

CREATE TABLE whitelist (domain TEXT UNIQUE NOT NULL, disabled BOOLEAN DEFAULT 0, comment TEXT, DateAdded DATETIME);
CREATE TABLE blacklist (domain TEXT UNIQUE NOT NULL, disabled BOOLEAN DEFAULT 0, comment TEXT, DateAdded DATETIME);
CREATE TABLE regex (domain TEXT UNIQUE NOT NULL, disabled BOOLEAN DEFAULT 0, comment TEXT, DateAdded DATETIME);
CREATE TABLE gravity (domain TEXT UNIQUE NOT NULL);
CREATE VIEW vw_gravity AS SELECT DISTINCT a.domain
FROM gravity a
WHERE a.domain NOT IN (SELECT domain from whitelist WHERE disabled != 1);
CREATE VIEW vw_blacklist AS SELECT DISTINCT a.domain
FROM blacklist a
WHERE a.disabled != 1 AND
a.domain NOT IN (SELECT domain from whitelist WHERE disabled != 1);
CREATE VIEW vw_whitelist AS SELECT DISTINCT a.domain
FROM whitelist a
WHERE a.disabled != 1;
CREATE VIEW vw_regex AS SELECT DISTINCT a.domain
FROM regex a
WHERE a.disabled != 1;