casbin / xorm-adapter

Xorm adapter for Casbin
https://github.com/casbin/casbin
Apache License 2.0
384 stars 58 forks source link

fix: duplication on adding policies to db #60

Closed ndodanli closed 1 year ago

casbin-bot commented 1 year ago

@tangyang9464 @JalinWang @imp2002 please review

ndodanli commented 1 year ago

@hsluoyz There is a column naming difference between databases that i think xorm column naming is responsible for this. For example, 'pgtype' for mysql and 'pg_type' for postgres. I determine by checking driver name but setting a fixed column name for all databases is better, but setting fixed column names is not up to me.

Also i saw a usage for directly calling "pgtype" on UpdateFilteredPolicies()(adapter.go:550)->queryString()(adapter.go:643) and this can cause problems on postgres. You might want to check on this.

hsluoyz commented 1 year ago

@ndodanli this PR is becoming more complicated, even involving home-made column names now. And the tests still failed. I have no confidence for this PR. So closed here. You can do de-duplication on your side anyway.