Skip to content
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

Migration breaks in gorm.io/gorm 1.25.6 when using pgx driver for PostgreSQL #217

Closed
jhberges opened this issue Jan 30, 2024 · 4 comments
Closed

Comments

@jhberges
Copy link

Specifically the change go-gorm/gorm@v1.25.5...v1.25.6#diff-7539aa7c170a85138fa67c7846b65fda95a51169bcf8637d5961ea570307d755 will end up with an error LastInsertId is not supported by this driver.

It seems to be the hasReturning(*gorm.DB,bool)(bool, gorm.ScanMode) in
gorm.io/gorm/callbacks/helper.go:96 that breaks existing functionality.
This file doesn't appear to be changed in the gorm.io version upgrade.

Might it look like that Gorm has started to require a RETURNING on the kind of INSERT/Create() that gormigrate perform?

Versions:
Go 1.21.5 linux/amd64
Gorm.io 1.25.6
Gormigrate 2.1.1 (v2 packages)

Works with versions:
Go 1.21.5 linux/amd64
Gorm.io 1.25.5
Gormigrate 2.1.1 (v2 packages)

@nanderv
Copy link

nanderv commented Feb 6, 2024

Same here. Rolling back to 1.25.5 fixes the issue here as well.

Also reported to gorm.

@magellancl
Copy link

I made the issue to gorm already, you can see it here go-gorm/gorm#6812.

The PR author is aware of it and said he is going to do a fix.

Same here. Rolling back to 1.25.5 fixes the issue here as well.

Also reported to gorm.

@oxyno-zeta
Copy link

oxyno-zeta commented Mar 18, 2024

Hello, I made a fix for this. I don't know if my Pull Request will be merged but I haven't created a branch from this fix to allow making a replace in my go.mod file.

Here is the patch commit:

replace github.com/go-gormigrate/gormigrate/v2 v2.1.1 => github.com/oxyno-zeta/gormigrate/v2 v2.0.0-20240318121440-b7e1f70e30f6

Here is the diff for this specific branch: master...oxyno-zeta:gormigrate:issue-217-replace

Have a good day !

@avakarev
Copy link
Contributor

avakarev commented Mar 18, 2024

@jhberges Thank you for reporting issue, @oxyno-zeta thank for the fix.
It's included in v2.1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants