-- --------------------------------------------------------
-- Server OS:                    Linux
-- HeidiSQL Version:             12.0.0.6468
-- --------------------------------------------------------


USE `laundry`;

-- Dumping structure for trigger laundry.kegiatan_after_update
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `kegiatan_after_update` AFTER UPDATE ON `kegiatan` FOR EACH ROW BEGIN
	IF NEW.STATUS = 2 THEN
		UPDATE laundry.mesin_kegiatan mk 
		   SET mk.STATUS = 2
		 WHERE mk.KEGIATAN = OLD.NOMOR;
	END IF;
	
	IF NEW.STATUS = 1 THEN
		UPDATE laundry.mesin_kegiatan mk 
		   SET mk.STATUS = 1
		 WHERE mk.KEGIATAN = OLD.NOMOR;
	END IF;
END//
DELIMITER ;

