DROP TABLE IF EXISTS `qs_ViewControllerLog`;
CREATE TABLE IF NOT EXISTS `qs_ViewControllerLog` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`role` enum('admin','staff','user') NOT NULL,
`roleId` int(10) unsigned NOT NULL,
`sessionId` char(32) NOT NULL,
`ip` int(11) NOT NULL,
`controller` varchar(128) NOT NULL,
`objectId` int(10) unsigned DEFAULT NULL,
`action` varchar(32) NOT NULL,
`message` text NOT NULL,
`added` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `role` (`role`),
KEY `roleId` (`roleId`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Структура таблицы `qs_ViewControllerLogSession`
--
DROP TABLE IF EXISTS `qs_ViewControllerLogSession`;
CREATE TABLE `qs_ViewControllerLogSession` (
`id` char(32) NOT NULL,
`role` enum('admin','staff','user') NOT NULL,
`roleId` int(11) NOT NULL,
`closed` enum('n','y') NOT NULL,
`added` datetime NOT NULL,
`changed` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `changed` (`changed`),
KEY `roleId` (`roleId`,`closed`),
KEY `added` (`added`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO `qs_SettingsCategory` (`id`, `name`, `system`, `sorter`) VALUES (5, 'Action Log', 'n', '4');
INSERT INTO `qs_Settings` (`name`, `idCategory`, `fieldType`, `label`, `value`, `options`, `description`, `required`, `system`, `sorter`, `added`, `changed`) VALUES
('viewControllerLogLiveTime', 5, 'App_ViewControllerLog_Admin_Form_Element_LiveTime', 'Automatically delete tracking information older than', '6', '', 'Action log history is currently stored on the site since {minDate} and taking up {size} of space.', 'y', 'n', 0, '2012-05-18 00:00:00', '2012-05-18 00:00:00');
UPDATE `qs_Settings` SET `description` = 'Action Log history has been stored on the website since {minDate} and is taking up {size} of space.' WHERE `name` = 'viewControllerLogLiveTime';
ALTER TABLE `qs_SettingsOptions` ADD `sorter` INT NULL DEFAULT NULL AFTER `type`;
DELETE FROM `qs_SettingsOptions` WHERE `name` = 'viewControllerLogLiveTime' AND `variable` LIKE 'multiOptions%';
SET @sorter := 0;
INSERT INTO `qs_SettingsOptions` (`id`, `name`, `variable`, `value`, `type`, `sorter`) VALUES
(NULL, 'viewControllerLogLiveTime', 'multiOptions[1]', '1 month', 'string', @sorter:=(@sorter+1)),
(NULL, 'viewControllerLogLiveTime', 'multiOptions[2]', '2 months', 'string', @sorter:=(@sorter+1)),
(NULL, 'viewControllerLogLiveTime', 'multiOptions[3]', '3 months', 'string', @sorter:=(@sorter+1)),
(NULL, 'viewControllerLogLiveTime', 'multiOptions[6]', '6 months', 'string', @sorter:=(@sorter+1)),
(NULL, 'viewControllerLogLiveTime', 'multiOptions[9]', '9 months', 'string', @sorter:=(@sorter+1)),
(NULL, 'viewControllerLogLiveTime', 'multiOptions[12]', '1 year', 'string', @sorter:=(@sorter+1));