From ab5fd74d69d9c9fd64e0e43b0b633851062d586d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20D=C3=B6ll?= Date: Tue, 7 May 2024 13:59:40 +0000 Subject: [PATCH] fix: table name prefix --- tbac.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tbac.go b/tbac.go index 4c1d5f6..fa2591e 100644 --- a/tbac.go +++ b/tbac.go @@ -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