diff options
Diffstat (limited to 'modules/gallery/helpers/gallery_installer.php')
-rw-r--r-- | modules/gallery/helpers/gallery_installer.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index d12dad70..fd2cd7f9 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -102,6 +102,16 @@ class gallery_installer { KEY `weight` (`weight` DESC)) ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + $db->query("DELIMITER | + CREATE TRIGGER setweight BEFORE INSERT ON {items} + FOR EACH ROW BEGIN + DECLARE new_weight int(9); + SELECT weight+1 FROM {items} + ORDER BY weight LIMIT 1 INTO new_weight; + SET NEW.weight = new_weight; + END;| + DELIMITER ;"); + $db->query("CREATE TABLE {logs} ( `id` int(9) NOT NULL auto_increment, `category` varchar(64) default NULL, |