Skip to content

Commit 9f68cf2

Browse files
committed
fix: change user_id index to user roles table to compound index
1 parent 0e11491 commit 9f68cf2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1515
### Migration
1616

1717
```sql
18-
CREATE INDEX IF NOT EXISTS user_roles_user_id_index ON user_roles (user_id);
18+
CREATE INDEX IF NOT EXISTS user_roles_app_id_tenant_id_user_id_index ON user_roles (app_id, tenant_id, user_id);
1919
```
2020
## [8.1.0]
2121

src/main/java/io/supertokens/storage/postgresql/queries/UserRolesQueries.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ public static String getQueryToCreateUserRolesRoleIndex(Start start) {
117117
}
118118

119119
public static String getQueryToCreateUserIdIndexForUserRolesTable(Start start) {
120-
return "CREATE INDEX IF NOT EXISTS user_roles_user_id_index ON " + getConfig(start).getUserRolesTable() +
121-
"(user_id);";
120+
return "CREATE INDEX IF NOT EXISTS user_roles_app_id_tenant_id_user_id_index ON " + getConfig(start).getUserRolesTable() +
121+
"(app_id, tenant_id, user_id);";
122122
}
123123

124124
public static boolean createNewRoleOrDoNothingIfExists_Transaction(Start start, Connection con,

0 commit comments

Comments
 (0)