Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL create 默认值这样不符合文档描述吧? (column default value) #7315

Open
gh73962 opened this issue Dec 12, 2024 · 0 comments
Open
Assignees
Labels
type:question general questions

Comments

@gh73962
Copy link

gh73962 commented Dec 12, 2024

Your Question

Type Model struct {
    UID int `gorm:"primaryKey"`
    Swtich1 int
    Swtich2 int
}

func CreateModel() {
    data := Model{UID:10001}
    db.Create(&data)
}
// on 	gorm.io/driver/mysql v1.5.7
// on	gorm.io/gorm v1.25.11
// log is sql cost=[8.190ms], rows=1, sql=INSERT INTO `database1`.`model` (`uid`,`swtich1`,`swtich1`) VALUES (10001,0,0)

image
image

Expected answer

按照文档 log应该是
INSERT INTO database1.model (uid) VALUES (10001);
是吗?

@gh73962 gh73962 added the type:question general questions label Dec 12, 2024
@gh73962 gh73962 changed the title MySQL create 默认值这样不符合稳定描述吧? (column default value) MySQL create 默认值这样不符合文档描述吧? (column default value) Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question general questions
Projects
None yet
Development

No branches or pull requests

2 participants