mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
Fine-tune adlist:adte_modified trigger and don't default new date_updated column to now but use NULL instead
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
4fd412d7c3
commit
12b9748c43
2 changed files with 10 additions and 3 deletions
|
@ -6,6 +6,13 @@ BEGIN TRANSACTION;
|
||||||
|
|
||||||
ALTER TABLE adlist ADD COLUMN date_updated INTEGER;
|
ALTER TABLE adlist ADD COLUMN date_updated INTEGER;
|
||||||
|
|
||||||
|
DROP TRIGGER tr_adlist_update;
|
||||||
|
|
||||||
|
CREATE TRIGGER tr_adlist_update AFTER UPDATE OF address,enabled,comment ON adlist
|
||||||
|
BEGIN
|
||||||
|
UPDATE adlist SET date_modified = (cast(strftime('%s', 'now') as int)) WHERE id = NEW.id;
|
||||||
|
END;
|
||||||
|
|
||||||
UPDATE info SET value = 13 WHERE property = 'version';
|
UPDATE info SET value = 13 WHERE property = 'version';
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
|
@ -32,7 +32,7 @@ CREATE TABLE adlist
|
||||||
date_added INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)),
|
date_added INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)),
|
||||||
date_modified INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)),
|
date_modified INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int)),
|
||||||
comment TEXT,
|
comment TEXT,
|
||||||
date_updated INTEGER NOT NULL DEFAULT (cast(strftime('%s', 'now') as int))
|
date_updated INTEGER
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE adlist_by_group
|
CREATE TABLE adlist_by_group
|
||||||
|
@ -86,9 +86,9 @@ CREATE TABLE client_by_group
|
||||||
PRIMARY KEY (client_id, group_id)
|
PRIMARY KEY (client_id, group_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TRIGGER tr_adlist_update AFTER UPDATE ON adlist
|
CREATE TRIGGER tr_adlist_update AFTER UPDATE OF address,enabled,comment ON adlist
|
||||||
BEGIN
|
BEGIN
|
||||||
UPDATE adlist SET date_modified = (cast(strftime('%s', 'now') as int)) WHERE address = NEW.address;
|
UPDATE adlist SET date_modified = (cast(strftime('%s', 'now') as int)) WHERE id = NEW.id;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
CREATE TRIGGER tr_client_update AFTER UPDATE ON client
|
CREATE TRIGGER tr_client_update AFTER UPDATE ON client
|
||||||
|
|
Loading…
Reference in a new issue