问题描述
我正在尝试将id
表中的当前organization
字段更改为UUID_SHORT,但失败了?
ALTER TABLE `organization` CHANGE `id` `id` BIGINT(16) UNSIGNED
NOT NULL DEFAULT uuid_short();
我没有看到任何错误消息吗?!
解决方法
我认为您不能像这样设置id
的默认值
相反,您可以创建触发器来执行此操作:
CREATE TRIGGER before_insert_organization
BEFORE INSERT ON organization
FOR EACH ROW
SET new.id = uuid_short();