1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-11-15 20:49:01 +00:00
pi-hole/advanced/Templates/gravity.db.sql
DL6ER 8a2363621d
Rename fields from DateAdded to dateadded
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-02-05 19:06:46 +01:00

22 lines
886 B
SQL

CREATE TABLE whitelist (domain TEXT UNIQUE NOT NULL, enabled BOOLEAN DEFAULT 1, comment TEXT, dateadded DATETIME);
CREATE TABLE blacklist (domain TEXT UNIQUE NOT NULL, enabled BOOLEAN DEFAULT 1, comment TEXT, dateadded DATETIME);
CREATE TABLE regex (domain TEXT UNIQUE NOT NULL, enabled BOOLEAN DEFAULT 1, 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 enabled == 1);
CREATE VIEW vw_blacklist AS SELECT DISTINCT a.domain
FROM blacklist a
WHERE a.enabled == 1 AND
a.domain NOT IN (SELECT domain from whitelist WHERE enabled == 1);
CREATE VIEW vw_whitelist AS SELECT DISTINCT a.domain
FROM whitelist a
WHERE a.enabled == 1;
CREATE VIEW vw_regex AS SELECT DISTINCT a.domain
FROM regex a
WHERE a.enabled == 1;