Skip to content

Commit

Permalink
fix: make sure index creation query is mysql compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
porcellus committed Oct 27, 2024
1 parent 8c742c6 commit ddb5b48
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ CREATE TABLE IF NOT EXISTS oauth_sessions (
FOREIGN KEY(app_id, client_id) REFERENCES oauth_clients(app_id, client_id) ON DELETE CASCADE
);

CREATE INDEX IF NOT EXISTS oauth_session_exp_index ON oauth_sessions(exp DESC);
CREATE INDEX IF NOT EXISTS oauth_session_external_refresh_token_index ON oauth_sessions(app_id, external_refresh_token DESC);
CREATE INDEX oauth_session_exp_index ON oauth_sessions(exp DESC);
CREATE INDEX oauth_session_external_refresh_token_index ON oauth_sessions(app_id, external_refresh_token DESC);

CREATE TABLE oauth_m2m_tokens (
app_id VARCHAR(64) DEFAULT 'public',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ public static String getQueryToCreateOAuthSessionsTable(Start start) {

public static String getQueryToCreateOAuthSessionsExpIndex(Start start) {
String oAuth2SessionTable = Config.getConfig(start).getOAuthSessionsTable();
return "CREATE INDEX IF NOT EXISTS oauth_session_exp_index ON "
return "CREATE INDEX oauth_session_exp_index ON "
+ oAuth2SessionTable + "(exp DESC);";
}

public static String getQueryToCreateOAuthSessionsExternalRefreshTokenIndex(Start start) {
String oAuth2SessionTable = Config.getConfig(start).getOAuthSessionsTable();
return "CREATE INDEX IF NOT EXISTS oauth_session_external_refresh_token_index ON "
return "CREATE INDEX oauth_session_external_refresh_token_index ON "
+ oAuth2SessionTable + "(app_id, external_refresh_token DESC);";
}

Expand All @@ -81,13 +81,13 @@ public static String getQueryToCreateOAuthM2MTokensTable(Start start) {

public static String getQueryToCreateOAuthM2MTokenIatIndex(Start start) {
String oAuth2M2MTokensTable = Config.getConfig(start).getOAuthM2MTokensTable();
return "CREATE INDEX IF NOT EXISTS oauth_m2m_token_iat_index ON "
return "CREATE INDEX oauth_m2m_token_iat_index ON "
+ oAuth2M2MTokensTable + "(iat DESC, app_id DESC);";
}

public static String getQueryToCreateOAuthM2MTokenExpIndex(Start start) {
String oAuth2M2MTokensTable = Config.getConfig(start).getOAuthM2MTokensTable();
return "CREATE INDEX IF NOT EXISTS oauth_m2m_token_exp_index ON "
return "CREATE INDEX oauth_m2m_token_exp_index ON "
+ oAuth2M2MTokensTable + "(exp DESC);";
}

Expand All @@ -111,7 +111,7 @@ public static String getQueryToCreateOAuthLogoutChallengesTable(Start start) {

public static String getQueryToCreateOAuthLogoutChallengesTimeCreatedIndex(Start start) {
String oAuth2LogoutChallengesTable = Config.getConfig(start).getOAuthLogoutChallengesTable();
return "CREATE INDEX IF NOT EXISTS oauth_logout_challenges_time_created_index ON "
return "CREATE INDEX oauth_logout_challenges_time_created_index ON "
+ oAuth2LogoutChallengesTable + "(time_created DESC);";
}

Expand Down

0 comments on commit ddb5b48

Please sign in to comment.