refactor(renameTable): refs #6125 clientCreditLimit to roleCreditLimit #1890
|
@ -0,0 +1,4 @@
|
||||||
|
RENAME TABLE `vn`.`clientCreditLimit` TO `vn`.`roleCreditLimit`;
|
||||||
|
ALTER TABLE `vn`.`clientCreditLimit` DROP FOREIGN KEY `clientCreditLimit_FK`;
|
||||||
|
ALTER TABLE `vn`.`roleCreditLimit` ADD CONSTRAINT `roleCreditLimit_FK` FOREIGN KEY (`roleFk`) REFERENCES `account`.`role`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||||
|
|
|
@ -493,7 +493,7 @@ INSERT INTO `vn`.`clientCredit`(`clientFk`, `workerFk`, `amount`, `created`)
|
||||||
(1104, 9, 90 , util.VN_CURDATE()),
|
(1104, 9, 90 , util.VN_CURDATE()),
|
||||||
(1105, 9, 90 , util.VN_CURDATE());
|
(1105, 9, 90 , util.VN_CURDATE());
|
||||||
|
|
||||||
INSERT INTO `vn`.`clientCreditLimit`(`id`, `maxAmount`, `roleFk`)
|
INSERT INTO `vn`.`roleCreditLimit`(`id`, `maxAmount`, `roleFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 9999999, 20),
|
(1, 9999999, 20),
|
||||||
(2, 10000, 21),
|
(2, 10000, 21),
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
"ClientCredit": {
|
"ClientCredit": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"ClientCreditLimit": {
|
"RoleCreditLimit": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"ClientConsumptionQueue": {
|
"ClientConsumptionQueue": {
|
||||||
|
|
|
@ -463,7 +463,7 @@ module.exports = Self => {
|
||||||
throw new UserError(`You can't change the credit set to zero from a financialBoss`);
|
throw new UserError(`You can't change the credit set to zero from a financialBoss`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const creditLimits = await models.ClientCreditLimit.find({
|
const creditLimits = await models.RoleCreditLimit.find({
|
||||||
fields: ['roleFk'],
|
fields: ['roleFk'],
|
||||||
where: {
|
where: {
|
||||||
maxAmount: {gte: changes.credit}
|
maxAmount: {gte: changes.credit}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"name": "ClientCreditLimit",
|
"name": "RoleCreditLimit",
|
||||||
"base": "VnModel",
|
"base": "VnModel",
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "clientCreditLimit"
|
"table": "roleCreditLimit"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
Loading…
Reference in New Issue