ALTER TABLE account.roleLog
	MODIFY COLUMN changedModel enum('Role', 'RoleInherit')
		CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT 'Role' NOT NULL;

UPDATE account.roleLog SET changedModel = 'RoleInherit'
	WHERE changedModel = '';

UPDATE account.roleLog
	SET oldInstance = JSON_REMOVE(oldInstance, '$.modified'),
		newInstance = JSON_REMOVE(newInstance, '$.modified')
	WHERE changedModel = 'Role'
		AND (JSON_VALUE(oldInstance, '$.modified') IS NOT NULL
		OR JSON_VALUE(newInstance, '$.modified') IS NOT NULL);

DELETE FROM account.roleLog
	WHERE oldInstance = '{}'
		AND newInstance = '{}'
		AND description IS NULL;
