mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-25 22:30:17 +00:00
61cfd2f9f9
Signed-off-by: DL6ER <dl6er@dl6er.de>
25 lines
1.3 KiB
SQL
25 lines
1.3 KiB
SQL
CREATE TABLE whitelist (domain TEXT UNIQUE NOT NULL, enabled BOOLEAN NOT NULL DEFAULT 1, date_added DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, comment TEXT);
|
|
CREATE TABLE blacklist (domain TEXT UNIQUE NOT NULL, enabled BOOLEAN NOT NULL DEFAULT 1, date_added DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, comment TEXT);
|
|
CREATE TABLE regex (filter TEXT UNIQUE NOT NULL, enabled BOOLEAN NOT NULL DEFAULT 1, date_added DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, comment TEXT);
|
|
CREATE TABLE adlists (address TEXT UNIQUE NOT NULL, enabled BOOLEAN NOT NULL DEFAULT 1, date_added DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, comment TEXT);
|
|
CREATE TABLE gravity (domain TEXT UNIQUE NOT NULL);
|
|
CREATE TABLE info (property TEXT NOT NULL, value TEXT NOT NULL);
|
|
|
|
INSERT INTO info VALUES("version","1");
|
|
|
|
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.filter
|
|
FROM regex a
|
|
WHERE a.enabled == 1;
|