From 678a8a78fbbbc4bd89b527df337e6af41910280c Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Fri, 7 Jun 2024 10:16:25 +0200 Subject: [PATCH] chore: synchronize workspaces --- .github/workflows/ci.yaml | 4 ++-- internal/driver.go | 13 +++++------ ...43000000_change_client_pk.cockroach.up.sql | 2 +- persistence/sql/persister_consent.go | 22 +++++++++---------- 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c85ba2aa558..7408776ffd3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -69,7 +69,7 @@ jobs: steps: - run: | docker create --name cockroach -p 26257:26257 \ - cockroachdb/cockroach:v22.1.10 start-single-node --insecure + cockroachdb/cockroach:v24.1.0 start-single-node --insecure docker start cockroach name: Start CockroachDB - uses: ory/ci/checkout@master @@ -170,7 +170,7 @@ jobs: steps: - run: | docker create --name cockroach -p 26257:26257 \ - cockroachdb/cockroach:v22.1.10 start-single-node --insecure + cockroachdb/cockroach:v24.1.0 start-single-node --insecure docker start cockroach name: Start CockroachDB - uses: ory/ci/checkout@master diff --git a/internal/driver.go b/internal/driver.go index 39526b62cd6..a08854f226d 100644 --- a/internal/driver.go +++ b/internal/driver.go @@ -9,19 +9,16 @@ import ( "testing" "github.com/go-jose/go-jose/v3" - - "github.com/ory/x/configx" - "github.com/stretchr/testify/require" - "github.com/ory/hydra/v2/x" - "github.com/ory/x/contextx" - "github.com/ory/x/sqlcon/dockertest" - "github.com/ory/hydra/v2/driver" "github.com/ory/hydra/v2/driver/config" "github.com/ory/hydra/v2/jwk" + "github.com/ory/hydra/v2/x" + "github.com/ory/x/configx" + "github.com/ory/x/contextx" "github.com/ory/x/logrusx" + "github.com/ory/x/sqlcon/dockertest" ) func resetConfig(p *config.DefaultProvider) { @@ -87,7 +84,7 @@ func ConnectToPG(t testing.TB) string { } func ConnectToCRDB(t testing.TB) string { - return dockertest.RunTestCockroachDBWithVersion(t, "v22.1.2") + return dockertest.RunTestCockroachDBWithVersion(t, "v24.1.0") } func ConnectDatabases(t *testing.T, migrate bool, ctxer contextx.Contextualizer) (pg, mysql, crdb driver.Registry, clean func(*testing.T)) { diff --git a/persistence/sql/migrations/20230908104443000000_change_client_pk.cockroach.up.sql b/persistence/sql/migrations/20230908104443000000_change_client_pk.cockroach.up.sql index 10d68872706..a74863aa6ca 100644 --- a/persistence/sql/migrations/20230908104443000000_change_client_pk.cockroach.up.sql +++ b/persistence/sql/migrations/20230908104443000000_change_client_pk.cockroach.up.sql @@ -1 +1 @@ -ALTER TABLE hydra_client ALTER PRIMARY KEY USING COLUMNS (id, nid) USING HASH; +ALTER TABLE hydra_client ALTER PRIMARY KEY USING COLUMNS (id, nid) USING HASH WITH bucket_count=16; diff --git a/persistence/sql/persister_consent.go b/persistence/sql/persister_consent.go index 9e461a3c913..9dc88865bd9 100644 --- a/persistence/sql/persister_consent.go +++ b/persistence/sql/persister_consent.go @@ -10,25 +10,21 @@ import ( "strings" "time" - "github.com/jmoiron/sqlx" - "github.com/gobuffalo/pop/v6" "github.com/gofrs/uuid" - - "github.com/ory/hydra/v2/oauth2/flowctx" - "github.com/ory/x/otelx" - "github.com/ory/x/sqlxx" - - "github.com/ory/x/errorsx" - + "github.com/jmoiron/sqlx" "github.com/pkg/errors" "github.com/ory/fosite" "github.com/ory/hydra/v2/client" "github.com/ory/hydra/v2/consent" "github.com/ory/hydra/v2/flow" + "github.com/ory/hydra/v2/oauth2/flowctx" "github.com/ory/hydra/v2/x" + "github.com/ory/x/errorsx" + "github.com/ory/x/otelx" "github.com/ory/x/sqlcon" + "github.com/ory/x/sqlxx" ) var _ consent.Manager = &Persister{} @@ -87,9 +83,11 @@ func (p *Persister) revokeConsentSession(whereStmt string, whereArgs ...interfac } count, err := c.RawQuery( - fmt.Sprintf( - "DELETE FROM hydra_oauth2_flow WHERE nid = ? AND consent_challenge_id IN (%s)", - sqlx.Rebind(sqlx.BindType(c.Dialect.Name()), strings.Join(args, ", ")), + sqlx.Rebind( + sqlx.BindType(c.Dialect.Name()), fmt.Sprintf( + "DELETE FROM hydra_oauth2_flow WHERE nid = ? AND consent_challenge_id IN (%s)", + strings.Join(args, ", "), + ), ), append( []interface{}{p.NetworkID(ctx)},