feat: refs #7713 Created ACLLog #2783
|
@ -0,0 +1,12 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `salix`.`ACL_afterDelete`
|
||||
AFTER DELETE ON `ACL`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO ACL
|
||||
SET `action` = 'delete',
|
||||
`changedModel` = 'Acl',
|
||||
`changedModelId` = OLD.id,
|
||||
`userFk` = account.myUser_getId();
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,8 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `salix`.`ACL_beforeInsert`
|
||||
BEFORE INSERT ON `ACL`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,8 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `salix`.`ACL_beforeUpdate`
|
||||
BEFORE UPDATE ON `ACL`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,25 @@
|
|||
CREATE OR REPLACE TABLE `salix`.`ACLLog` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`originFk` int(11) DEFAULT NULL,
|
||||
`userFk` int(10) unsigned DEFAULT NULL,
|
||||
`action` set('insert','update','delete','select') NOT NULL,
|
||||
`creationDate` timestamp NULL DEFAULT current_timestamp(),
|
||||
`description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
|
||||
`changedModel` enum('Acl') NOT NULL DEFAULT 'Acl',
|
||||
`oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)),
|
||||
`newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)),
|
||||
`changedModelId` int(11) NOT NULL,
|
||||
`changedModelValue` varchar(45) DEFAULT NULL,
|
||||
`summaryId` varchar(30) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `logRateuserFk` (`userFk`),
|
||||
KEY `ACLLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
|
||||
KEY `ACLLog_originFk` (`originFk`,`creationDate`),
|
||||
CONSTRAINT `aclUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||
|
||||
ALTER TABLE salix.ACL
|
||||
ADD editorFk int(10) unsigned DEFAULT NULL NULL;
|
||||
|
||||
ALTER TABLE vn.ticket
|
||||
CHANGE editorFk editorFk int(10) unsigned DEFAULT NULL NULL AFTER risk;
|
Loading…
Reference in New Issue