type Tablex struct {
    Age decimal.Decimal `json:"age" gorm:"column:age;type:decimal(10, 4)"`
}

func TestMigreate2(t *testing.T) {
    openDb()
    err := db.Migrator().AutoMigrate(&Tablex{}) // 运行后,数据库中还是 decimal(10,2)
    fmt.Println(err)
}

Comment From: github-actions[bot]

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 2 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking

Comment From: myface-wang

我也出现了这个问题 1、在windows下测试,不能改变小数点精度。 2、发布到linux服务器上运行却将小数点精度变为了0。但只有这个新建的表是这样,之前建的表中decimal字段却不受影响。 以上的两个问题。 第一个问题始终存在。 第二个问题,我将字段删除后重建恢复正常了,可能与第一次建表时将类型写成uint有关。