ALTER TABLE `account`.`user` ADD passExpired DATE DEFAULT NULL;

DROP TRIGGER IF EXISTS `account`.`user_beforeUpdate`;
USE account;

DELIMITER $$
$$
CREATE DEFINER=`root`@`localhost` TRIGGER `account`.`user_beforeUpdate`
	BEFORE UPDATE ON `user`
	FOR EACH ROW
BEGIN
	IF !(NEW.`name` <=> OLD.`name`) THEN
		CALL user_checkName (NEW.`name`);
	END IF;

	IF !(NEW.`password` <=> OLD.`password`) THEN
		SET NEW.lastPassChange = util.VN_NOW();
	END IF;
END$$
DELIMITER ;
