Skip to content

Commit

Permalink
feat: remove unused indices (#3859)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr authored Oct 14, 2024
1 parent 0cd00dc commit 56fc3da
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
4 changes: 3 additions & 1 deletion oauth2/oauth2_auth_code_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func TestAuthCodeWithDefaultStrategy(t *testing.T) {
GrantAccessTokenAudience: rr.RequestedAccessTokenAudience,
Session: &hydra.AcceptOAuth2ConsentRequestSession{
AccessToken: map[string]interface{}{"foo": "bar"},
IdToken: map[string]interface{}{"bar": "baz"},
IdToken: map[string]interface{}{"bar": "baz", "email": "[email protected]"},
},
}).
Execute()
Expand Down Expand Up @@ -206,6 +206,8 @@ func TestAuthCodeWithDefaultStrategy(t *testing.T) {
assert.EqualValues(t, expectedSubject, claims.Get("sub").String(), "%s", claims)
assert.EqualValues(t, expectedNonce, claims.Get("nonce").String(), "%s", claims)
assert.EqualValues(t, `baz`, claims.Get("bar").String(), "%s", claims)
assert.EqualValues(t, `[email protected]`, claims.Get("email").String(), "%s", claims)
assert.NotEmpty(t, claims.Get("sid").String(), "%s", claims)

return claims
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- CREATE INDEX IF NOT EXISTS hydra_oauth2_access_client_id_subject_idx ON hydra_oauth2_access (client_id ASC, subject ASC, nid ASC);
CREATE INDEX IF NOT EXISTS hydra_oauth2_access_expires_at_v2_idx ON hydra_oauth2_access (expires_at ASC);

CREATE INDEX IF NOT EXISTS hydra_oauth2_refresh_client_id_subject_idx ON hydra_oauth2_refresh (client_id ASC, subject ASC);
CREATE INDEX IF NOT EXISTS hydra_oauth2_refresh_expires_at_v2_idx ON hydra_oauth2_refresh (expires_at ASC);

CREATE INDEX IF NOT EXISTS hydra_oauth2_pkce_request_id_idx ON hydra_oauth2_pkce (request_id ASC, nid ASC);
CREATE INDEX IF NOT EXISTS hydra_oauth2_pkce_expires_at_v2_idx ON hydra_oauth2_pkce (expires_at ASC);

CREATE INDEX IF NOT EXISTS hydra_oauth2_oidc_request_id_idx ON hydra_oauth2_oidc (request_id ASC, nid ASC);
CREATE INDEX IF NOT EXISTS hydra_oauth2_oidc_expires_at_idx ON hydra_oauth2_oidc (expires_at ASC);

CREATE INDEX IF NOT EXISTS hydra_oauth2_pkce_request_id_idx ON hydra_oauth2_code (request_id ASC, nid ASC);
CREATE INDEX IF NOT EXISTS hydra_oauth2_pkce_expires_at_v2_idx ON hydra_oauth2_code (expires_at ASC);
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- DROP INDEX hydra_oauth2_access_client_id_subject_idx ON hydra_oauth2_access;
DROP INDEX hydra_oauth2_access_expires_at_v2_idx ON hydra_oauth2_access; -- janitor still uses requested_at index

DROP INDEX hydra_oauth2_refresh_client_id_subject_idx ON hydra_oauth2_refresh;
DROP INDEX hydra_oauth2_refresh_expires_at_v2_idx ON hydra_oauth2_refresh; -- janitor still uses requested_at index

DROP INDEX hydra_oauth2_pkce_request_id_idx ON hydra_oauth2_pkce;
DROP INDEX hydra_oauth2_pkce_expires_at_v2_idx ON hydra_oauth2_pkce; -- janitor still uses requested_at index

DROP INDEX hydra_oauth2_oidc_request_id_idx ON hydra_oauth2_oidc;
DROP INDEX hydra_oauth2_oidc_expires_at_idx ON hydra_oauth2_oidc; -- janitor still uses requested_at index

DROP INDEX hydra_oauth2_code_request_id_idx ON hydra_oauth2_code;
DROP INDEX hydra_oauth2_code_expires_at_v2_idx ON hydra_oauth2_code; -- janitor still uses requested_at index
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
DROP INDEX IF EXISTS hydra_oauth2_access_client_id_subject_idx;
DROP INDEX IF EXISTS hydra_oauth2_access_expires_at_v2_idx; -- janitor still uses requested_at index

DROP INDEX IF EXISTS hydra_oauth2_refresh_client_id_subject_idx;
DROP INDEX IF EXISTS hydra_oauth2_refresh_expires_at_v2_idx; -- janitor still uses requested_at index

DROP INDEX IF EXISTS hydra_oauth2_pkce_request_id_idx;
DROP INDEX IF EXISTS hydra_oauth2_pkce_expires_at_v2_idx; -- janitor still uses requested_at index

DROP INDEX IF EXISTS hydra_oauth2_oidc_request_id_idx;
DROP INDEX IF EXISTS hydra_oauth2_oidc_expires_at_idx; -- janitor still uses requested_at index

DROP INDEX IF EXISTS hydra_oauth2_code_request_id_idx;
DROP INDEX IF EXISTS hydra_oauth2_code_expires_at_v2_idx; -- janitor still uses requested_at index

0 comments on commit 56fc3da

Please sign in to comment.