1 CREATE TABLE forum_mysqlftsindex (
2 id int NOT NULL AUTO_INCREMENT,
3 node_id int NOT NULL UNIQUE,
4 body longtext NOT NULL,
8 FOREIGN KEY (node_id) REFERENCES forum_node (id) ON UPDATE CASCADE ON DELETE CASCADE,
9 FULLTEXT (body, title, tagnames)
12 ALTER TABLE forum_mysqlftsindex CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
16 CREATE TRIGGER fts_on_insert AFTER INSERT ON forum_node
19 INSERT INTO forum_mysqlftsindex (node_id, title, body, tagnames) VALUES (NEW.id, UPPER(NEW.title), UPPER(NEW.body), UPPER(NEW.tagnames));
25 CREATE TRIGGER fts_on_update AFTER UPDATE ON forum_node
28 UPDATE forum_mysqlftsindex SET title = UPPER(NEW.title), body = UPPER(NEW.body), tagnames = UPPER(NEW.tagnames) WHERE node_id = NEW.id;
33 INSERT INTO forum_mysqlftsindex (node_id, title, body, tagnames) SELECT id, UPPER(title), UPPER(body), UPPER(tagnames) FROM forum_node;