Skip to content

Commit

Permalink
Merge pull request #91 from closetool/master
Browse files Browse the repository at this point in the history
fix: create index when using custom schema
  • Loading branch information
hsluoyz authored Mar 23, 2021
2 parents ae4ce83 + c1c559e commit fb0d729
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,11 @@ func (a *Adapter) casbinRuleTable() func(db *gorm.DB) *gorm.DB {
func (a *Adapter) createTable() error {
t := a.db.Statement.Context.Value(customTableKey{})

if t == nil {
t = a.getTableInstance()
if t != nil {
return a.db.AutoMigrate(t)
}

t = a.getTableInstance()
if err := a.db.AutoMigrate(t); err != nil {
return err
}
Expand Down

0 comments on commit fb0d729

Please sign in to comment.