Skip to content

Commit

Permalink
fix: add primary_user_id index
Browse files Browse the repository at this point in the history
  • Loading branch information
sattvikc committed Nov 21, 2023
1 parent 5039fdd commit abf5a8d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [5.0.4] - 2023-11-23

- Adds `app_id_to_user_id_primary_user_id_index` index on `app_id_to_user_id` table

### Migration

Run the following sql script:

```sql
CREATE INDEX IF NOT EXISTS app_id_to_user_id_primary_user_id_index ON app_id_to_user_id (primary_or_recipe_user_id, app_id);
```

## [5.0.3] - 2023-11-10

- Fixes issue with email verification with user id mapping
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id 'java-library'
}

version = "5.0.3"
version = "5.0.4"

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,11 @@ static String getQueryToCreateAppIdIndexForAppIdToUserIdTable(Start start) {
+ Config.getConfig(start).getAppIdToUserIdTable() + "(app_id);";
}

static String getQueryToCreatePrimaryUserIdIndexForAppIdToUserIdTable(Start start) {
return "CREATE INDEX IF NOT EXISTS app_id_to_user_id_primary_user_id_index ON "
+ Config.getConfig(start).getAppIdToUserIdTable() + "(primary_or_recipe_user_id, app_id);";
}

public static void createTablesIfNotExists(Start start) throws SQLException, StorageQueryException {
int numberOfRetries = 0;
boolean retry = true;
Expand Down Expand Up @@ -264,6 +269,7 @@ public static void createTablesIfNotExists(Start start) throws SQLException, Sto

// index
update(start, getQueryToCreateAppIdIndexForAppIdToUserIdTable(start), NO_OP_SETTER);
update(start, getQueryToCreatePrimaryUserIdIndexForAppIdToUserIdTable(start), NO_OP_SETTER);
}

if (!doesTableExists(start, Config.getConfig(start).getUsersTable())) {
Expand Down

0 comments on commit abf5a8d

Please sign in to comment.