PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
DROP TABLE IF EXISTS 'domainlist_by_group';
DROP TABLE IF EXISTS 'group';
DROP TABLE IF EXISTS 'domainlist';
DROP TABLE IF EXISTS 'adlist';
CREATE TABLE IF NOT EXISTS "group"
(
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    enabled BOOLEAN NOT NULL DEFAULT 1,
    name TEXT UNIQUE NOT NULL,
    date_added INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)),
    date_modified INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)),
    description TEXT
);
INSERT INTO "group" VALUES(0,1,'Default',1719171501,1719171501,'The default group');
CREATE TABLE domainlist
(
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    type INTEGER NOT NULL DEFAULT 0,
    domain TEXT NOT NULL,
    enabled BOOLEAN NOT NULL DEFAULT 1,
    date_added INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)),
    date_modified INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)),
    comment TEXT,
    UNIQUE(domain, type)
);
INSERT INTO domainlist VALUES(1,0,'trace.svc.ui.com',1,1719175843,1719175843,'Added from Query Log');
INSERT INTO domainlist VALUES(2,0,'etahub.com',1,1719175898,1719175898,'Added from Query Log');
INSERT INTO domainlist VALUES(3,2,'(\.|^)www\.bit\.ly$',1,1637022623,1637022623,'');
INSERT INTO domainlist VALUES(4,2,'(\.|^)bit\.ly$',1,1637022630,1637022630,'');
INSERT INTO domainlist VALUES(5,2,'(\.|^)ow\.ly$',1,1637022635,1637022635,'');
INSERT INTO domainlist VALUES(6,2,'(\.|^)tinyurl\.com$',1,1637022641,1637022641,'');
INSERT INTO domainlist VALUES(7,2,'(\.|^)cdn\.optimizely\.com$',1,1637022655,1637022655,'');
INSERT INTO domainlist VALUES(8,2,'(\.|^)s\.shopify\.com$',1,1637022665,1637022665,'');
INSERT INTO domainlist VALUES(9,2,'(\.|^)appsflyer\.com$',1,1637023127,1637023127,'');
INSERT INTO domainlist VALUES(10,0,'scribe.logs.roku.com',1,1637298626,1637298626,'Added from Query Log');
INSERT INTO domainlist VALUES(11,0,'api.us-east-1.aiv-delivery.net',1,1637298630,1637298630,'Added from Query Log');
INSERT INTO domainlist VALUES(12,0,'s3-iad-2.cf.dash.row.aiv-cdn.net',1,1637298633,1637298633,'Added from Query Log');
INSERT INTO domainlist VALUES(15,0,'go.zextras.com',1,1637506050,1637506050,'Added from Query Log');
INSERT INTO domainlist VALUES(17,0,'metrics.roblox.com',1,1640316765,1640316765,'Added from Query Log');
INSERT INTO domainlist VALUES(18,0,'metrics.icloud.com',1,1640316822,1640316822,'Added from Query Log');
INSERT INTO domainlist VALUES(19,0,'device-metrics-us-2.amazon.com',1,1640316834,1640316834,'Added from Query Log');
INSERT INTO domainlist VALUES(20,2,'(\.|^)boincstats\.com$',1,1641094542,1641094542,'');
INSERT INTO domainlist VALUES(21,0,'graph.microsoft.com',1,1641679994,1641679994,'Added from Query Log');
INSERT INTO domainlist VALUES(22,0,'googleads.g.doubleclick.net',1,1641680205,1641680205,'Added from Query Log');
INSERT INTO domainlist VALUES(25,0,'supportmetrics.apple.com',1,1644089354,1644089354,'Added from Query Log');
INSERT INTO domainlist VALUES(26,0,'securemetrics.apple.com',1,1644089357,1644089357,'Added from Query Log');
INSERT INTO domainlist VALUES(27,2,'(\.|^)thingiverse\.com$',1,1646104635,1646104635,'');
INSERT INTO domainlist VALUES(28,0,'va.msg.liveperson.net',1,1652031710,1652031710,'Added from Query Log');
INSERT INTO domainlist VALUES(29,0,'api.rlcdn.com',1,1652320312,1652320312,'Added from Query Log');
INSERT INTO domainlist VALUES(33,0,'target.georiot.com',1,1656552690,1656552690,'Added from Query Log');
INSERT INTO domainlist VALUES(36,0,'aax-us-iad.amazon.com',1,1669388468,1669388468,'Added from Query Log');
INSERT INTO domainlist VALUES(37,2,'(\.|^)scity\.xyz$',1,1675046189,1675046189,'');
INSERT INTO domainlist VALUES(38,0,'triggers.wfxtriggers.com',1,1676233061,1676233061,'Added from Query Log');
INSERT INTO domainlist VALUES(39,0,'static.criteo.net',1,1676233065,1676233065,'Added from Query Log');
INSERT INTO domainlist VALUES(40,0,'tags.crwdcntrl.net',1,1676233070,1676233070,'Added from Query Log');
INSERT INTO domainlist VALUES(42,0,'mparticle.weather.com',1,1676233074,1676233074,'Added from Query Log');
INSERT INTO domainlist VALUES(43,0,'cloudservices.roku.com',1,1676233235,1676233235,'Added from Query Log');
INSERT INTO domainlist VALUES(44,0,'mask.icloud.com',1,1676233423,1676233423,'');
INSERT INTO domainlist VALUES(45,0,'ip-api.com',1,1676233521,1676233521,'Added from Query Log');
INSERT INTO domainlist VALUES(46,0,'self.events.data.microsoft.com',1,1676239590,1676239590,'Added from Query Log');
INSERT INTO domainlist VALUES(48,2,'(\.|^)applovin\.com$',1,1676240765,1676240765,'');
INSERT INTO domainlist VALUES(50,0,'ema.torguard.net',1,1677342738,1677342738,'Added from Query Log');
INSERT INTO domainlist VALUES(51,0,'teams.events.data.microsoft.com',1,1686973596,1686973596,'Added from Query Log');
INSERT INTO domainlist VALUES(52,2,'(\.|^)misfitsmc\.com$',1,1687228117,1687228117,'');
INSERT INTO domainlist VALUES(58,2,'(\.|^)totalav\.com$',1,1688008280,1688008280,'');
INSERT INTO domainlist VALUES(59,2,'(\.|^)protected\.net$',1,1688008823,1688008823,'');
INSERT INTO domainlist VALUES(60,0,'kinesis.us-west-2.amazonaws.com',1,1709130709,1709130709,'Added from Query Log');
INSERT INTO domainlist VALUES(61,2,'(\.|^)scity\.us$',1,1622482071,1622482071,'');
INSERT INTO domainlist VALUES(62,2,'(\.|^)schroedercity\.com$',1,1622482080,1622482080,'');
INSERT INTO domainlist VALUES(63,0,'www.googleadservices.com',1,1719800556,1719800766,'Added from Query Log');
INSERT INTO domainlist VALUES(64,0,'fls-na.amazon.com',1,1721584587,1721584587,'Added from Query Log');
INSERT INTO domainlist VALUES(65,0,'ipm.avcdn.net',1,1724593720,1724593720,'Added from Query Log');
INSERT INTO domainlist VALUES(66,0,'mobile.events.data.microsoft.com',1,1728179935,1728179935,'Added from Query Log');
CREATE TABLE adlist
(
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    address TEXT UNIQUE NOT NULL,
    enabled BOOLEAN NOT NULL DEFAULT 1,
    date_added INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)),
    date_modified INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)),
    comment TEXT,
    date_updated INTEGER,
    number INTEGER NOT NULL DEFAULT 0,
    invalid_domains INTEGER NOT NULL DEFAULT 0,
    status INTEGER NOT NULL DEFAULT 0
);
INSERT INTO adlist VALUES(1,'https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts',0,1719171501,1719873562,'Migrated from /etc/pihole/adlists.list',1719739921,161604,1,1);
INSERT INTO adlist VALUES(2,'https://v.firebog.net/hosts/static/w3kbl.txt',1,1719873553,1719873553,NULL,1736675702,351,0,2);
INSERT INTO adlist VALUES(3,'https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Spam/hosts',0,1719873568,1719873570,NULL,NULL,0,0,0);
INSERT INTO adlist VALUES(4,'https://www.github.developerdan.com/hosts/lists/ads-and-tracking-extended.txt',1,1719873575,1728180003,NULL,1736675702,429286,0,2);
INSERT INTO adlist VALUES(5,'https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/pro.txt',1,1719873584,1719873584,NULL,1736675703,0,0,2);
CREATE TABLE domainlist_by_group
(
    domainlist_id INTEGER NOT NULL REFERENCES domainlist (id),
    group_id INTEGER NOT NULL REFERENCES "group" (id),
    PRIMARY KEY (domainlist_id, group_id)
);
INSERT INTO domainlist_by_group(rowid,domainlist_id,group_id) VALUES(1,1,0);
INSERT INTO domainlist_by_group(rowid,domainlist_id,group_id) VALUES(2,2,0);
INSERT INTO domainlist_by_group(rowid,domainlist_id,group_id) VALUES(3,3,0);
INSERT INTO domainlist_by_group(rowid,domainlist_id,group_id) VALUES(4,63,0);
INSERT INTO domainlist_by_group(rowid,domainlist_id,group_id) VALUES(5,64,0);
INSERT INTO domainlist_by_group(rowid,domainlist_id,group_id) VALUES(6,65,0);
INSERT INTO domainlist_by_group(rowid,domainlist_id,group_id) VALUES(7,66,0);
COMMIT;
