Closed nsarup closed 1 year ago
@tangyang9464 @JalinWang @imp2002
@nsarup see: casbin/gorm-adapter#156 (comment)
I think it's probably caused by other fields.
gorm-adapter
now has 8 fields while `casbin-pg-adapter only has 6.
// in GORM-adapter
type CasbinRule struct {
ID uint `gorm:"primaryKey;autoIncrement"`
Ptype string `gorm:"size:100"`
V0 string `gorm:"size:100"`
V1 string `gorm:"size:100"`
V2 string `gorm:"size:100"`
V3 string `gorm:"size:100"`
V4 string `gorm:"size:100"`
V5 string `gorm:"size:100"`
V6 string `gorm:"size:25"`
V7 string `gorm:"size:25"`
}
In casbin-pg-adapter
:
https://github.com/casbin/casbin-pg-adapter/blob/master/adapter.go#L19-L29
@JalinWang he said:
The GORM adapter is able to read columns V0-5 but unable to read column ptype in the CasbinRule structure.
So I think v6 and v7 will not cause ptype to fail?
Actually, what's your suggested solution for this issue?
Can we remove extra fields in gorm-adapter
? Other adapters only have v0
-v5
.
@tangyang9464
@JalinWang we just added v6 and v7 in PR: https://github.com/casbin/gorm-adapter/pull/157 , you should find another solution
@nsarup gorm-adapter has reverted the PR and restored to use up to v5 fields: https://github.com/casbin/gorm-adapter/pull/181 , now we need to upgrade the gorm-adapter version in this repo
Issue:
I have a database written by the casbin API (which uses the casbin-pg-adapter).
The structure of the database looks like:
The GORM adapter is able to read columns V0-5 but unable to read column ptype in the CasbinRule structure.
As a result a panic is thrown