diff --git a/callbacks.go b/callbacks.go index fdde21e9..e21e0718 100644 --- a/callbacks.go +++ b/callbacks.go @@ -83,7 +83,11 @@ func (p *processor) Execute(db *DB) { if stmt.Model != nil { if err := stmt.Parse(stmt.Model); err != nil && (!errors.Is(err, schema.ErrUnsupportedDataType) || (stmt.Table == "" && stmt.SQL.Len() == 0)) { - db.AddError(err) + if errors.Is(err, schema.ErrUnsupportedDataType) && stmt.Table == "" { + db.AddError(fmt.Errorf("%w: Table not set, please set it like: db.Model(&user) or db.Table(\"users\")", err)) + } else { + db.AddError(err) + } } } diff --git a/tests/go.mod b/tests/go.mod index c92fa0cf..cbafcd7e 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -7,10 +7,10 @@ require ( github.com/jinzhu/now v1.1.1 github.com/lib/pq v1.6.0 gorm.io/driver/mysql v1.0.1 - gorm.io/driver/postgres v1.0.1 + gorm.io/driver/postgres v1.0.2 gorm.io/driver/sqlite v1.1.3 gorm.io/driver/sqlserver v1.0.4 - gorm.io/gorm v1.20.1 + gorm.io/gorm v1.20.2 ) replace gorm.io/gorm => ../