Merge pull request '#6513 create supplier dms' (!2082) from 6513-createSupplierDms into dev
gitea/salix/pipeline/head There was a failure building this commit Details

Reviewed-on: #2082
Reviewed-by: Guillermo Bonet <guillermo@verdnatura.es>
Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
This commit is contained in:
Jorge Penadés 2024-02-26 12:33:56 +00:00
commit 4bcf61fc68
4 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,12 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierDms_afterDelete`
AFTER DELETE ON `supplierDms`
FOR EACH ROW
BEGIN
INSERT INTO clientLog
SET `action` = 'delete',
`changedModel` = 'supplierDms',
`changedModelId` = OLD.dmsFk,
`userFk` = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierDms_beforeInsert`
BEFORE INSERT ON `supplierDms`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierDms_beforeUpdate`
BEFORE UPDATE ON `supplierDms`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -0,0 +1,9 @@
ALTER TABLE `vn`.`supplierDms`
MODIFY COLUMN supplierFk int(10) unsigned NOT NULL,
ADD editorFk INT UNSIGNED NULL,
ADD CONSTRAINT user_Fk FOREIGN KEY (editorFk) REFERENCES account.`user`(id),
ADD CONSTRAINT dms_FK FOREIGN KEY (dmsFk) REFERENCES vn.dms(id) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT supplier_Fk FOREIGN KEY (supplierFk) REFERENCES vn.supplier(id) ON UPDATE CASCADE;
ALTER TABLE `supplierLog`
MODIFY COLUMN `changedModel` ENUM('Supplier','SupplierAddress','SupplierAccount','SupplierContact','SupplierDms') NOT NULL DEFAULT 'Supplier';