-
-
Notifications
You must be signed in to change notification settings - Fork 360
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缺失,迁移后,创建的表无自增属性,导致执行sql失败 #215
Comments
好的,收到 |
我提交gorm的修复pr没有被接受,因为改动不兼容其他的db。。。 放弃提交了。。。 |
更新了下,请查看,未测试 |
我没有看到你的pr |
我给关了。。。 go-gorm/gorm#5452 |
你这个字段名字叫的不那么达意呀~ 哈哈哈哈 要么也跟gorm叫的一样。。。 autoIncrement 呢~ |
这:3dea08f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
数据表中的主键是自增的,生成go文件后,tag中未包含自增的描述
autoIncrement
当执行
db. AutoMigrate
后,插入一条数据会报错:gorm迁移的sql语句是:
解决方案:在生成go文件的时候,把是否自增的信息写进tag中。
详细tag参考:https://gorm.io/zh_CN/docs/models.html#%E5%AD%97%E6%AE%B5%E6%A0%87%E7%AD%BE
经过了解,这是两个bug:
The text was updated successfully, but these errors were encountered: