Closed morremeyer closed 2 years ago
I will merge recent commits from upstream soon and let you know, so you can retest this. I am 99% sure the reason is falling back behind upstream, specifically they had recent commits for supporting DDL with type sizes brb
Merged the upstream. Can you get latest (non-tagged) version from master and re-test?
Re-tested, can't reproduce the problem. Thanks for the fast response and taking care of it!
Bug
Using
db.AutoMigrate
with a specific Model causes the sqlite module to return an errorinvalid DDL, unbalanced brackets
.This is happening in https://github.com/envelope-zero/backend/blob/2adc00f348d0be5ad0101d72fbe37f2ecbc95bbf/main.go#L47. Using
git bisect
, I tracked it back to the upgrade of gorm to1.23.6
, (this commit), however, I am not sure why it only started occuring there.The bug does not occur with the upstream sqlite driver.
Details
The error specifically seems to occur on the
Transactions
model. Tracing it back by debugging theparseDDL
function, I noticed that one call to the function is broken.parseDDL
is called with one string:Notice the
part, which is clearly broken. The model specifies this as
The error is returned on
ddlmod.go
, line 77, with abracketLevel
of-1
.Reproduction
git clone https://github.com/envelope-zero/backend.git
go run main.go
and attach a debugger with set breakpoints (In VSCode, you can use theRun API (SQLite)
Additional info
I’d like to debug this further, but so far I failed to find a good approach to find out where the string gets mangled and wasn't able to find this out. I’ll happily debug this further once I find an approach and I’m happy about any input anyone might be able to provide.