Update dictionaries delete trigger to also delete linguistics rows
This commit is contained in:
parent
81f938b2c0
commit
3b4acdf1f3
|
@ -22,11 +22,13 @@ CREATE TABLE IF NOT EXISTS `dictionaries` (
|
||||||
`created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
`created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=352 ;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=352 ;
|
||||||
DROP TRIGGER IF EXISTS `delete_words`;
|
DROP TRIGGER IF EXISTS `delete_dictionary_parts`;
|
||||||
DELIMITER //
|
DELIMITER //
|
||||||
CREATE TRIGGER `delete_words` AFTER DELETE ON `dictionaries`
|
CREATE TRIGGER `delete_dictionary_parts` AFTER DELETE ON `dictionaries`
|
||||||
FOR EACH ROW DELETE FROM words
|
FOR EACH ROW BEGIN
|
||||||
WHERE words.dictionary=old.id
|
DELETE FROM words WHERE words.dictionary=old.id;
|
||||||
|
DELETE FROM dictionary_linguistics WHERE dictionary_linguistics.dictionary=old.id;
|
||||||
|
END
|
||||||
//
|
//
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue