Error 1292: Incorrect datetime value: '0000-00-00' for column 'created_at' at row 1
在mysql里改了一下配置(把NO_ZERO_DATE去掉了)
```
SET GLOBAL sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
```
就可以插入了,但是在插入前打印结构体`user.CreatedAt`显示的是`0001-01-01 00:00:00 +0000 UTC`,插入后去表里看到的时间却是正确的时间,例如`2019-10-22 13:38:28`,真的服了,不知道咋回事
#7
更多评论
```go
type User struct {
gorm.Model
Username string `gorm:"type:varchar(20);unique_index"`
Password string `gorm:"type:varchar(64)"`
Phone string `gorm:"type:char(11);unique_index"`
}
```
#2