8062-testToMaster_2 #3059
|
@ -10,7 +10,7 @@ BEGIN
|
||||||
SELECT * FROM (
|
SELECT * FROM (
|
||||||
SELECT cc.client clientFk, ci.grade
|
SELECT cc.client clientFk, ci.grade
|
||||||
FROM creditClassification cc
|
FROM creditClassification cc
|
||||||
JOIN creditInsurance ci ON cc.id = ci.creditClassification
|
JOIN creditInsurance ci ON cc.id = ci.creditClassificationFk
|
||||||
WHERE dateEnd IS NULL
|
WHERE dateEnd IS NULL
|
||||||
ORDER BY ci.creationDate DESC
|
ORDER BY ci.creationDate DESC
|
||||||
LIMIT 10000000000000000000) t1
|
LIMIT 10000000000000000000) t1
|
||||||
|
|
|
@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`creditInsurance_afterIn
|
||||||
BEGIN
|
BEGIN
|
||||||
UPDATE `client` c
|
UPDATE `client` c
|
||||||
JOIN vn.creditClassification cc ON cc.client = c.id
|
JOIN vn.creditClassification cc ON cc.client = c.id
|
||||||
SET creditInsurance = NEW.credit WHERE cc.id = NEW.creditClassification;
|
SET creditInsurance = NEW.credit WHERE cc.id = NEW.creditClassificationFk;
|
||||||
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`creditInsurance_beforeInsert`
|
|
||||||
BEFORE INSERT ON `creditInsurance`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
IF NEW.creditClassificationFk THEN
|
|
||||||
SET NEW.creditClassification = NEW.creditClassificationFk;
|
|
||||||
END IF;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`solunionCAP_afterInsert
|
||||||
BEGIN
|
BEGIN
|
||||||
UPDATE client c
|
UPDATE client c
|
||||||
JOIN creditClassification cc ON cc.client = c.id
|
JOIN creditClassification cc ON cc.client = c.id
|
||||||
JOIN creditInsurance ci ON ci.creditClassification = cc.id
|
JOIN creditInsurance ci ON ci.creditClassificationFk = cc.id
|
||||||
SET creditInsurance = ci.credit * 2 WHERE ci.id = NEW.creditInsurance;
|
SET creditInsurance = ci.credit * 2 WHERE ci.id = NEW.creditInsurance;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -6,12 +6,12 @@ BEGIN
|
||||||
IF NEW.dateLeaving IS NOT NULL THEN
|
IF NEW.dateLeaving IS NOT NULL THEN
|
||||||
UPDATE client c
|
UPDATE client c
|
||||||
JOIN creditClassification cc ON cc.client = c.id
|
JOIN creditClassification cc ON cc.client = c.id
|
||||||
JOIN creditInsurance ci ON ci.creditClassification = cc.id
|
JOIN creditInsurance ci ON ci.creditClassificationFk = cc.id
|
||||||
SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance;
|
SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance;
|
||||||
ELSE
|
ELSE
|
||||||
UPDATE client c
|
UPDATE client c
|
||||||
JOIN creditClassification cc ON cc.client = c.id
|
JOIN creditClassification cc ON cc.client = c.id
|
||||||
JOIN creditInsurance ci ON ci.creditClassification = cc.id
|
JOIN creditInsurance ci ON ci.creditClassificationFk = cc.id
|
||||||
SET creditInsurance = ci.credit * 2 WHERE ci.id = OLD.creditInsurance;
|
SET creditInsurance = ci.credit * 2 WHERE ci.id = OLD.creditInsurance;
|
||||||
END IF;
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`solunionCAP_beforeDelet
|
||||||
BEGIN
|
BEGIN
|
||||||
UPDATE client c
|
UPDATE client c
|
||||||
JOIN creditClassification cc ON cc.client = c.id
|
JOIN creditClassification cc ON cc.client = c.id
|
||||||
JOIN creditInsurance ci ON ci.creditClassification = cc.id
|
JOIN creditInsurance ci ON ci.creditClassificationFk = cc.id
|
||||||
SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance;
|
SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE vn.creditInsurance
|
||||||
|
CHANGE creditClassification creditClassification__ int(11) DEFAULT NULL COMMENT '@deprecated 2024-09-11';
|
Loading…
Reference in New Issue