Merge pull request 'refactor: refs #6701 New table clientRate' (!2536) from 6701-clientRate into dev
gitea/salix/pipeline/head This commit looks good Details
gitea/salix/pipeline/pr-dev This commit looks good Details

Reviewed-on: #2536
Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
This commit is contained in:
Guillermo Bonet 2024-06-05 06:17:10 +00:00
commit 3dab181bff
2 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,11 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`claimRatio_afterInsert`
AFTER INSERT ON `claimRatio`
FOR EACH ROW
BEGIN
INSERT INTO clientRate(clientFk, `value`)
VALUES(NEW.clientFk, NEW.priceIncreasing)
ON DUPLICATE KEY UPDATE
`value` = VALUES(`value`);
END$$
DELIMITER ;

View File

@ -0,0 +1,9 @@
CREATE TABLE `vn`.`clientRate` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`clientFk` int(11) NOT NULL,
`dated` date NOT NULL DEFAULT current_timestamp(),
`value` decimal(10,2) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `clientRate_unique` (`clientFk`,`dated`),
CONSTRAINT `clientRate_client_FK` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;