6995-testToMaster_2410 #2139

Merged
alexm merged 236 commits from 6995-testToMaster_2410 into master 2024-03-07 07:09:08 +00:00
4 changed files with 36 additions and 1 deletions
Showing only changes of commit 3c038a060c - Show all commits

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

@ -4,7 +4,14 @@ CREATE TABLE IF NOT EXISTS vn.supplierDms(
dmsFk int(11) NOT NULL, dmsFk int(11) NOT NULL,
editorFk int(10) unsigned DEFAULT NULL, editorFk int(10) unsigned DEFAULT NULL,
PRIMARY KEY (id), PRIMARY KEY (id),
CONSTRAINT clientDms_fk_editor FOREIGN KEY (editorFk) REFERENCES account.user(id), CONSTRAINT supplierDms_fk_editor FOREIGN KEY (editorFk) REFERENCES account.user(id),
CONSTRAINT dmsFk FOREIGN KEY (dmsFk) REFERENCES dms(id) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT dmsFk FOREIGN KEY (dmsFk) REFERENCES dms(id) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT supplierFk FOREIGN KEY (supplierFk) REFERENCES supplier(id) ON UPDATE CASCADE CONSTRAINT supplierFk FOREIGN KEY (supplierFk) REFERENCES supplier(id) ON UPDATE CASCADE
); );
ALTER TABLE `supplierLog`
MODIFY COLUMN `changedModel` ENUM('Supplier','SupplierAddress','SupplierAccount','SupplierContact','SupplierDms') NOT NULL DEFAULT 'Supplier';
ALTER TABLE `vn`.`supplierDms`
ADD IF NOT EXISTS editorFk INT UNSIGNED NULL,
ADD CONSTRAINT supplierDms_fk_editor FOREIGN KEY IF NOT EXISTS (editorFk) REFERENCES account.`user`(id);