MySQl 创建表时timestamp类型字段出错
CREATE TABLE `sync_test` ( `id` varchar(32) NOT NULL, `int_two` smallint(6) DEFAULT NULL COMMENT '整型2', `int_four` int(11) DEFAULT NULL COMMENT '整型4', `float_four` float DEFAULT NULL COMMENT '浮点型4', `float_eight` double DEFAULT NULL COMMENT '浮点型8', `sync_numeric` decimal(16,2) DEFAULT NULL COMMENT '小数(总长度16,小数位2)', `sync_bool` tinyint(1) DEFAULT NULL COMMENT '布尔型', `sync_text` text COMMENT 'text类型', `int_eight` bigint(20) DEFAULT NULL COMMENT '整型8', `create_timestamp` timestamp DEFAULT NULL COMMENT '时间(timestamp)', `create_date` date DEFAULT NULL COMMENT '时间(date)', `create_time` time DEFAULT NULL COMMENT '时间(time)', `sync_char` char(32) DEFAULT NULL COMMENT 'char类型', `sync_bytea` blob COMMENT 'bytea类型', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
上述代码执行报错:1067 - Invalid default value for 'create_timestamp'
应改成
`create_timestamp` timestamp NULL DEFAULT NULL COMMENT '时间(timestamp)',