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

Error When Re-Open the Database #2

Open
KiddoV opened this issue Aug 12, 2022 · 7 comments
Open

Error When Re-Open the Database #2

KiddoV opened this issue Aug 12, 2022 · 7 comments
Labels
bug Something isn't working

Comments

@KiddoV
Copy link

KiddoV commented Aug 12, 2022

I got this error when trying to reopen the database the second time.
The first time when doing gorm.Open the DB file will be automatically generate, when I reload the script, I got this err:

dburl := fmt.Sprintf("go-sqlcipher.sqlite?_pragma_key=multitechPassword&_pragma_cipher_page_size=4096")
gormDb, err := gorm.Open(sqliteEncrypt.Open(dburl), &gorm.Config{SkipDefaultTransaction: true, PrepareStmt: true})
2022/08/12 14:24:11 C:/Users/vho/go/pkg/mod/github.com/jackfr0st13/gorm-sqlite-cipher@v0.1.0/migrator.go:108 sql: converting argument $1 type: unsupported type
clause.Expr, a struct

Please be advised!

@mearaj
Copy link

mearaj commented Aug 13, 2022

Hi,
I am also facing the exact same issue.

@zakaria-chahboun
Copy link

yes the same!

@D4ryl00
Copy link

D4ryl00 commented Jun 9, 2023

Any updates?

@jackfr0st13
Copy link
Owner

Hello ! Due to other commitments, I am not finding enough time to actively maintain this package. If you can create a pull request for the fix, I would be more than happy to review and merge it. Thank you :)

@jackfr0st13 jackfr0st13 added the bug Something isn't working label Jun 11, 2023
@D4ryl00
Copy link

D4ryl00 commented Jun 12, 2023

Hi! We don't use your lib, but this one: github.com/flyingtime/gorm-sqlcipher before its author deleted it.
And we have exactly the same behavior as yours...
I'll dig and if I find something I'll let you know.

@D4ryl00
Copy link

D4ryl00 commented Jun 19, 2023

Hi, I found a solution for this bug. You have to implement directly the ColumnTypes method in your Migrator, like the official sqlite drive does (https://github.com/go-gorm/sqlite). So the gorm.ColumnType will be correctly populated and the bug will go away.
You can view the PR I did on my side for the other library here: berty/berty#4703

@KiddoV
Copy link
Author

KiddoV commented Oct 4, 2023

Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants