Skip to content

Commit

Permalink
fix: table name prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie committed May 7, 2024
1 parent ad8b8a2 commit ab5fd74
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tbac.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func RunMigrations(db *gorm.DB) error {
return err
}

query := db.Raw("SELECT A.user_id, A.team_id, C.scope as permission FROM " + db.Config.NamingStrategy.TableName("user_roles") + "AS A LEFT JOIN role_permissions AS B ON A.role_id = B.role_id LEFT JOIN permissions AS C on B.permission_id = C.id;")
query := db.Raw("SELECT A.user_id, A.team_id, C.scope as permission FROM " + db.Config.NamingStrategy.TableName("user_roles") + " AS A LEFT JOIN role_permissions AS B ON A.role_id = B.role_id LEFT JOIN permissions AS C on B.permission_id = C.id;")
err = db.Migrator().CreateView("vw_user_team_permissions", gorm.ViewOption{Query: query, Replace: true})
if err != nil {
return err
Expand Down

0 comments on commit ab5fd74

Please sign in to comment.