124.sql (723B)
1 -- +migrate Up 2 drop trigger links_before_update; 3 drop trigger links_before_delete; 4 drop trigger links_after_insert; 5 drop trigger links_after_update; 6 7 -- +migrate StatementBegin 8 CREATE TRIGGER links_before_update 9 BEFORE UPDATE ON links WHEN old.deleted_at IS NULL AND new.deleted_at IS NOT NULL BEGIN 10 DELETE FROM fts5_links WHERE id=old.id; 11 END; 12 13 CREATE TRIGGER links_before_update1 14 BEFORE UPDATE ON links WHEN old.deleted_at IS NOT NULL AND new.deleted_at IS NULL BEGIN 15 INSERT INTO fts5_links(rowid, uuid, url, title, description, created_at, visited_at) VALUES 16 (new.id, new.uuid, new.url, new.title, new.description, new.created_at, new.visited_at); 17 END; 18 -- +migrate StatementEnd 19 20 -- +migrate Down