Mysql 设置更新时间自动触发

1、使用工具navicat,勾选即可

  

 

 

2、语句  ON UPDATE CURRENT_TIMESTAMP(0)

  

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `tm_ecological_user`;
CREATE TABLE `tm_ecological_user`  (
  `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',

  `update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
  `creator` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '创建人',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `UK_phone`(`phone_number`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1398 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'xx' ROW_FORMAT = Compact;

SET FOREIGN_KEY_CHECKS = 1;

 

posted on 2020-06-08 11:03  滚动的蛋  阅读(1015)  评论(0编辑  收藏  举报

导航