Merge pull request '3653-refactor(clientInsurance): rename column add Fk' (#997) from 3653-clientInsurance into dev
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
Reviewed-on: #997 Reviewed-by: Javi Gallego <jgallego@verdnatura.es> Reviewed-by: Carlos Jimenez Ruiz <carlosjr@verdnatura.es>
This commit is contained in:
commit
9dbd1e6f72
|
@ -0,0 +1,8 @@
|
||||||
|
ALTER TABLE `vn`.`creditInsurance` ADD creditClassificationFk int(11) NULL;
|
||||||
|
|
||||||
|
UPDATE `vn`.`creditInsurance` AS `destiny`
|
||||||
|
SET `destiny`.`creditClassificationFk`= (SELECT creditClassification FROM `vn`.`creditInsurance` AS `origin` WHERE `origin`.id = `destiny`.id);
|
||||||
|
|
||||||
|
ALTER TABLE `vn`.`creditInsurance`
|
||||||
|
ADD CONSTRAINT `creditInsurance_creditClassificationFk` FOREIGN KEY (`creditClassificationFk`)
|
||||||
|
REFERENCES `vn`.`creditClassification` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@ -0,0 +1,11 @@
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
CREATE DEFINER=`root`@`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 ;
|
|
@ -458,7 +458,7 @@ INSERT INTO `vn`.`creditClassification`(`id`, `client`, `dateStart`, `dateEnd`)
|
||||||
(4, 1104, CURDATE(), CURDATE()),
|
(4, 1104, CURDATE(), CURDATE()),
|
||||||
(5, 1105, CURDATE(), CURDATE());
|
(5, 1105, CURDATE(), CURDATE());
|
||||||
|
|
||||||
INSERT INTO `vn`.`creditInsurance`(`id`, `creditClassification`, `credit`, `creationDate`, `grade`)
|
INSERT INTO `vn`.`creditInsurance`(`id`, `creditClassificationFk`, `credit`, `creationDate`, `grade`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, 3000, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL),
|
(1, 1, 3000, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL),
|
||||||
(2, 2, 6000, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), NULL),
|
(2, 2, 6000, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), NULL),
|
||||||
|
|
|
@ -38,7 +38,7 @@ module.exports = Self => {
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
await models.CreditInsurance.create({
|
await models.CreditInsurance.create({
|
||||||
creditClassification: newClassification.id,
|
creditClassificationFk: newClassification.id,
|
||||||
credit: data.credit,
|
credit: data.credit,
|
||||||
grade: data.grade
|
grade: data.grade
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
"insurances": {
|
"insurances": {
|
||||||
"type": "hasMany",
|
"type": "hasMany",
|
||||||
"model": "CreditInsurance",
|
"model": "CreditInsurance",
|
||||||
"foreignKey": "creditClassification"
|
"foreignKey": "creditClassificationFk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -24,7 +24,7 @@ module.exports = function(Self) {
|
||||||
let filter = {
|
let filter = {
|
||||||
fields: ['grade'],
|
fields: ['grade'],
|
||||||
where: {
|
where: {
|
||||||
creditClassification: this.creditClassification
|
creditClassificationFk: this.creditClassificationFk
|
||||||
},
|
},
|
||||||
order: 'created DESC'
|
order: 'created DESC'
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
"classification": {
|
"classification": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "CreditClassification",
|
"model": "CreditClassification",
|
||||||
"foreignKey": "creditClassification"
|
"foreignKey": "creditClassificationFk"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scope": {
|
"scope": {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<vn-crud-model
|
<vn-crud-model
|
||||||
vn-id="model"
|
vn-id="model"
|
||||||
url="CreditInsurances"
|
url="CreditInsurances"
|
||||||
link="{creditClassification: $ctrl.$params.classificationId}"
|
link="{creditClassificationFk: $ctrl.$params.classificationId}"
|
||||||
limit="20"
|
limit="20"
|
||||||
data="insurances"
|
data="insurances"
|
||||||
auto-load="true">
|
auto-load="true">
|
||||||
|
|
Loading…
Reference in New Issue