Could we add an hourly cron job to run something like this?
$ cd /path/to/demo && docker-compose restart openmrs-referenceapplication-mysql
Would that be enough to reset the demo’s database hourly?
Also, in the past (ITSM-3917 → help desk #9245), we added this SQL to the demo database to prevent people from accidentally (or nefariously) changing the admin’s username or password:
DELIMITER ;;
CREATE TRIGGER users_update BEFORE UPDATE ON users FOR EACH ROW
IF OLD.user_id = 1 THEN
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'admin user account is locked';
END IF;;
CREATE TRIGGER users_delete BEFORE DELETE ON users FOR EACH ROW
IF OLD.user_id = 1 THEN
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'admin user account is locked';
END IF;;
DELIMITER ;
The triggers can be remove when/if needed with:
drop trigger users_update;
drop trigger users_delete;