DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`shelving_BEFORE_UPDATE`
	BEFORE UPDATE ON `shelving`
	FOR EACH ROW
BEGIN
	SET NEW.editorFk = account.myUser_getId();

	IF NEW.code = "" THEN
		CALL util.throw('NOT_EMPTY_CODE_ALLOWED');
	END IF;

	IF NOT(OLD.parkingFk <=> NEW.parkingFK) THEN
        SET NEW.isMoving = FALSE;
    END IF;
END$$
DELIMITER ;
