mysql - 使用 UUID_Short 更改字段失败?
问题描述
我正在尝试将表中的当前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();
推荐阅读
- .htaccess - Symfony 5 上的重定向问题
- linux - Ansible return code error: 'dict object' has no attribute 'rc'
- python - 校准工作进行时如何在 tkinter 标签上显示值
- c++ - 在 QMap 上的 std::transform
- c++ - 将类成员函数地址传递给初始化列表中的另一个成员
- python - 在字符串和整数的嵌套/平面列表中查找超过 10 的最小数字
- java - 从 GitLab CI 运行 sonarqube 时出错
- java - Android相机保存图像,但不确定保存在哪里
- python - 程序不能只返回 True False
- javascript - 仅在 iOS 中单击表单提交按钮时 GIF 停止动画