eulaurarien/database_schema.sql

24 lines
990 B
MySQL
Raw Normal View History

-- Remember to increment DB_VERSION
-- in database.py on changes to this file
CREATE TABLE blocking (
key TEXT PRIMARY KEY, -- Contains the reversed domain name or IP in binary form
source TEXT, -- The rule this one is based on
type INTEGER, -- Type of the field: 1: AS, 2: domain tree, 3: domain, 4: IPv4 network, 6: IPv6 network
updated INTEGER, -- If the row was updated during last data import (0: No, 1: Yes)
firstparty INTEGER, -- Which blocking list this row is issued from (0: first-party, 1: multi-party)
2019-12-09 17:21:08 +00:00
refs INTEGER, -- Which blocking list this row is issued from (0: first-party, 1: multi-party) (used for -only lists)
level INTEGER, -- Level of recursion to the original rule (used for source priority)
FOREIGN KEY (source) REFERENCES blocking(key) ON DELETE CASCADE
);
2019-12-09 17:21:08 +00:00
CREATE INDEX "blocking_type_key" ON "blocking" (
"type",
"key" DESC
);
-- Store various things
CREATE TABLE meta (
key TEXT PRIMARY KEY,
value integer
);