From ed90957ab594dcd19a6f2328839114c263817a17 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 12 Jan 2023 11:45:11 +0100 Subject: [PATCH 1/2] fix: corregida primaryKey de mdbApp --- db/changes/225202/00-mdbApp.sql | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 db/changes/225202/00-mdbApp.sql diff --git a/db/changes/225202/00-mdbApp.sql b/db/changes/225202/00-mdbApp.sql new file mode 100644 index 000000000..50c595d71 --- /dev/null +++ b/db/changes/225202/00-mdbApp.sql @@ -0,0 +1,28 @@ +ALTER TABLE `vn`.`mdbApp` DROP PRIMARY KEY; +ALTER TABLE `vn`.`mdbApp` ADD CONSTRAINT mdbApp_PK PRIMARY KEY (app,baselineBranchFk); + +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('com','master'); +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('enc','master'); +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('ent','master'); +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('eti','master'); +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('lab','master'); +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('tpv','master'); +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('com','dev'); +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('enc','dev'); +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('ent','dev'); +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('eti','dev'); +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('lab','dev'); +INSERT INTO `vn`.`mdbApp` (app,baselineBranchFk) + VALUES ('tpv','dev'); + From da8b6b7f2d478cbe8aa3f430e1748cee005ad796 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 12 Jan 2023 11:52:27 +0100 Subject: [PATCH 2/2] fix: comprueba que hay registros --- modules/mdb/back/methods/mdbVersion/upload.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mdb/back/methods/mdbVersion/upload.js b/modules/mdb/back/methods/mdbVersion/upload.js index 5dfe5d3ef..ea88c58f7 100644 --- a/modules/mdb/back/methods/mdbVersion/upload.js +++ b/modules/mdb/back/methods/mdbVersion/upload.js @@ -65,7 +65,7 @@ module.exports = Self => { try { const mdbApp = await models.MdbApp.findById(appName, null, myOptions); - if (mdbApp.locked && mdbApp.userFk != userId) { + if (mdbApp && mdbApp.locked && mdbApp.userFk != userId) { throw new UserError($t('App locked', { userId: mdbApp.userFk }));