/**
  only update columns when values not empty
 */

UPDATE 
 `user` 
 
SET 
	`role` = CASE WHEN :role <> '' THEN :role ELSE `role` END,  

	`profile` = CASE WHEN :firstname <> '' THEN JSON_SET( `profile`, '$.firstname', :firstname ) ELSE `profile` END, 
	`profile` = CASE WHEN :lastname <> '' THEN JSON_SET( `profile`, '$.lastname', :lastname ) ELSE `profile` END, 
	`profile` = CASE WHEN :avatar <> '' THEN JSON_SET( `profile`, '$.avatar', :avatar ) ELSE `profile` END, 
	`profile` = CASE WHEN :email <> '' THEN JSON_SET( `profile`, '$.email', :email ) ELSE `profile` END

WHERE 
 `ID` = :ID
