Being that UUID() isn't accepted as a DEFAULT constraint, you need to use a trigger.
This one sets the value for the NEW_TABLE.uuid
column:
delimiter $$
CREATE
DEFINER=`root`@`localhost`
TRIGGER `example`.`newid`
BEFORE INSERT ON `example`.`new_table`
FOR EACH ROW
BEGIN
SET NEW.`uuid` = UUID();
END
$$
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…