7152-devToTest_2414 #2228

Merged
alexm merged 636 commits from 7152-devToTest_2414 into test 2024-03-28 08:26:34 +00:00
5 changed files with 62 additions and 5 deletions
Showing only changes of commit c54c9ce913 - Show all commits

View File

@ -0,0 +1,12 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`parking_afterDelete`
AFTER DELETE ON `parking`
FOR EACH ROW
BEGIN
INSERT INTO parkingLog
SET `action` = 'delete',
`changedModel` = 'Parking',
`changedModelId` = OLD.id,
`userFk` = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`parking_beforeInsert`
BEFORE INSERT ON `parking` BEFORE INSERT ON `parking`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
SET NEW.editorFk = account.myUser_getId();
-- SET new.`code` = CONCAT(new.`column`,' - ',new.`row`) ; -- SET new.`code` = CONCAT(new.`column`,' - ',new.`row`) ;
END$$ END$$

View File

@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`parking_beforeUpdate`
BEFORE UPDATE ON `parking` BEFORE UPDATE ON `parking`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
SET NEW.editorFk = account.myUser_getId();
-- SET new.`code` = CONCAT(new.`column`,' - ',new.`row`) ; -- SET new.`code` = CONCAT(new.`column`,' - ',new.`row`) ;
END$$ END$$

View File

@ -0,0 +1,43 @@
CREATE OR REPLACE TABLE `vn`.`parkingLog` (
`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('Parking','SaleGroup','SaleGroupDetail') NOT NULL DEFAULT 'Parking',
`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,
PRIMARY KEY (`id`),
KEY `logParkinguserFk` (`userFk`),
KEY `parkingLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
KEY `parkingLog_originFk` (`originFk`,`creationDate`),
CONSTRAINT `parkingOriginFk` FOREIGN KEY (`originFk`) REFERENCES `parking` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `parkingUserFk` 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 vn.parking DROP COLUMN IF EXISTS editorFk;
ALTER TABLE IF EXISTS vn.parking ADD COLUMN editorFk INT;
ALTER TABLE vn.saleGroupDetail DROP COLUMN IF EXISTS editorFk;
ALTER TABLE IF EXISTS vn.saleGroupDetail ADD COLUMN editorFk INT;

View File

@ -20,9 +20,6 @@
"type": "string", "type": "string",
"required": true "required": true
}, },
"sectorFk": {
"type": "number"
},
"code": { "code": {
"type": "string" "type": "string"
}, },
@ -35,6 +32,11 @@
"type": "hasMany", "type": "hasMany",
"model": "saleGroup", "model": "saleGroup",
"foreignKey": "parkingFk" "foreignKey": "parkingFk"
},
"sector": {
"type": "belongsTo",
"model": "Sector",
"foreignKey": "sectorFk"
} }
} }
} }