golang tag不带gorm也会创建表

type Student struct {
Age int
Name string
}

func (it *ServiceContext) AutoMigrate() {
it.DB.AutoMigrate(
&Student{},
)
}
// 数据库中照样会创建这张 student 表,并且该表 有 age name 这两个字段

posted @ 2022-04-12 19:07  技术颜良  阅读(56)  评论(0编辑  收藏  举报