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:
DL6ER 2020-09-07 21:11:57 +02:00
parent 4fd412d7c3
commit 12b9748c43
No known key found for this signature in database
GPG key ID: 00135ACBD90B28DD
2 changed files with 10 additions and 3 deletions

View file

@ -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;

View file

@ -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