-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
用tag指定数据库字段为int类型的字段默认值时,create函数生成的sql语句多了一列 #6247
Comments
The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the |
show your case!!! |
The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the |
实在很抱歉,我不知道如何正规的提交bug,简而言之,如果我将实体类中的id字段设为了int类型并用tag指明了默认值,那么gorm最后自动生成的sql语句会多出一个id字段,我将我的代码和数据库都在附件中提交给了您,劳烦您看一下,我用的依赖版本为
gorm.io/driver/mysql v1.5.0
gorm.io/gorm v1.25.0
我知道将id设为有默认值不合理,但是我想知道为什么会出现这种情况。谢谢您。
罗红霉素.
***@***.***
…------------------ 原始邮件 ------------------
发件人: "go-gorm/gorm" ***@***.***>;
发送时间: 2023年4月23日(星期天) 下午4:18
***@***.***>;
***@***.******@***.***>;
主题: Re: [go-gorm/gorm] 用tag指定数据库字段为int类型的字段默认值时,create函数生成的sql语句多了一列 (Issue #6247)
show your case!!!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the |
The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the |
你的结构体 type File struct { |
你试试加上 primarykey, 不加这个 gorm 不能识别这是一个主键
|
type User struct { |
The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the |
GORM Playground Link
go-gorm/playground#1
Description
The text was updated successfully, but these errors were encountered: