go-gorm / go-gorm/sqlite

AutoMigrate failed when type has custom size or precision

Open
#121 2 comments 2 reactions 1 assignee Claimed by @jinzhu View on GitHub
Dominant language
Go
Stars
231
Forks
217
PR merge metrics
No merged PRs in 30d

Description

## GORM Playground Link

```
type Product struct {
Price float64 `gorm:"type:decimal(10,2);not null"`
}

...

DB.AutoMigrate(Product{})
```

## Description
The database is initialized normally for the first time, but it crashes after restarting the application, returning the error `invaild DDL, unbalanced brackets`

According to my repeated debugging, the problem appears in `migrate.go`
At line 89, it would replace `decimal (10,2)` to `?, 2)`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.