From 5f60f2a00e5ad227541c9682386223c828e7787f Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 12 Feb 2024 15:04:49 +0100 Subject: [PATCH] refs #5509 feat(EntryDms): add fixtures --- db/dump/fixtures.before.sql | 3 +- db/versions/10841-orangeGalax/00-entryDms.sql | 73 +------------------ .../10841-orangeGalax/00-entryDmsType.vn.sql | 2 + 3 files changed, 8 insertions(+), 70 deletions(-) create mode 100644 db/versions/10841-orangeGalax/00-entryDmsType.vn.sql diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 0b0e53612..66cb59e9d 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -2408,7 +2408,8 @@ INSERT INTO `vn`.`dmsType`(`id`, `name`, `readRoleFk`, `writeRoleFk`, `code`) (17, 'cmr', NULL, NULL, 'cmr'), (18, 'dua', NULL, NULL, 'dua'), (19, 'inmovilizado', NULL, NULL, 'fixedAssets'), - (20, 'ReclamaciĆ³n', 1, 1, 'claim'); + (20, 'ReclamaciĆ³n', 1, 1, 'claim'), + (21, 'Entrada', 1, 1, 'entry'); INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`) VALUES diff --git a/db/versions/10841-orangeGalax/00-entryDms.sql b/db/versions/10841-orangeGalax/00-entryDms.sql index 2d078d255..d8c495d6d 100644 --- a/db/versions/10841-orangeGalax/00-entryDms.sql +++ b/db/versions/10841-orangeGalax/00-entryDms.sql @@ -10,78 +10,13 @@ CREATE OR REPLACE TABLE `vn`.`entryDms` ( CONSTRAINT `entryDms_entry` FOREIGN KEY (`entryFk`) REFERENCES `entry` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; --- DROP TRIGGER IF EXISTS `vn`.`entryDms_beforeInsert`; --- USE `vn`; - --- DELIMITER $$ --- $$ --- CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_beforeInsert` --- BEFORE INSERT ON `entryDms` --- FOR EACH ROW --- BEGIN --- SET NEW.editorFk = account.myUser_getId(); --- END $$ --- DELIMITER ; - --- DROP TRIGGER IF EXISTS `vn`.`entryDms_beforeUpdate`; --- USE `vn`; - --- DELIMITER $$ --- $$ --- CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_beforeUpdate` --- BEFORE UPDATE ON `entryDms` --- FOR EACH ROW --- BEGIN --- SET NEW.editorFk = account.myUser_getId(); --- END $$ --- DELIMITER ; - --- DROP TRIGGER IF EXISTS `vn`.`entryDms_beforeDelete`; --- USE `vn`; - --- DELIMITER $$ --- $$ --- CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_beforeDelete` --- BEFORE DELETE ON `entryDms` --- FOR EACH ROW --- BEGIN --- UPDATE dms --- SET dmsTypeFk = (SELECT id --- FROM dmsType --- WHERE `code` = 'trash' --- ) --- WHERE id = OLD.dmsFk AND ( SELECT IF(COUNT(*) > 0, FALSE, TRUE) --- FROM entryDms --- WHERE dmsFk = OLD.dmsFk --- ) ; --- END $$ --- DELIMITER ; - --- DROP TRIGGER IF EXISTS `vn`.`entryDms_afterDelete`; --- USE `vn`; - --- DELIMITER $$ --- $$ --- CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_afterDelete` --- AFTER DELETE ON `entryDms` --- FOR EACH ROW --- BEGIN --- INSERT INTO entryLog --- SET `action` = 'delete', --- `changedModel` = 'entryDms', --- `changedModelId` = OLD.entryFk, --- `userFk` = account.myUser_getId(); --- END $$ --- DELIMITER ; - - INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('WorkerDms', '*', '*', 'ALLOW', 'ROLE', 'employee'), ('EntryDms', '*', '*', 'ALLOW', 'ROLE', 'employee'), ('Entry', 'uploadFile', 'WRITE', 'ALLOW', 'ROLE', 'employee'); --- UPDATE `salix`.`ACL` --- SET accessType = '*' --- WHERE model = 'ClientDms' --- AND property = '*'; +UPDATE `salix`.`ACL` + SET accessType = '*' + WHERE model = 'ClientDms' + AND property = '*'; diff --git a/db/versions/10841-orangeGalax/00-entryDmsType.vn.sql b/db/versions/10841-orangeGalax/00-entryDmsType.vn.sql new file mode 100644 index 000000000..d408ab827 --- /dev/null +++ b/db/versions/10841-orangeGalax/00-entryDmsType.vn.sql @@ -0,0 +1,2 @@ +INSERT INTO `vn`.`dmsType` (code, name, path__, writeRoleFk, readRoleFk, monthToDelete) + VALUES('entry', 'Entrada', '', 1, 1, NULL);