From 8c286e6340ee56c4900a2b587e64699b41ead7d6 Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Mon, 2 Dec 2024 11:47:47 +0100 Subject: [PATCH] refactor: move to common Ory migration helpers This patch brings Ory Keto SQL migrations in line with CLI patterns from Kraots and Hydra. BREAKING CHANGE: Please update your migration scripts: ```patch - keto migrate up + keto migrate sql up - keto migrate down 2 + keto migrate sql down --steps 2 - keto migrate status + keto migrate sql status ``` --- cmd/migrate/down.go | 78 ------------------- cmd/migrate/migrate_test.go | 12 +-- cmd/migrate/root.go | 84 +++++++++++++++++--- cmd/migrate/status.go | 74 ------------------ cmd/migrate/up.go | 106 -------------------------- go.mod | 44 +++++------ go.sum | 92 +++++++++++----------- internal/driver/registry_default.go | 12 ++- internal/persistence/definitions.go | 5 +- internal/persistence/sql/persister.go | 15 ++++ 10 files changed, 171 insertions(+), 351 deletions(-) delete mode 100644 cmd/migrate/down.go delete mode 100644 cmd/migrate/status.go delete mode 100644 cmd/migrate/up.go diff --git a/cmd/migrate/down.go b/cmd/migrate/down.go deleted file mode 100644 index 2c3b50ad3..000000000 --- a/cmd/migrate/down.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright © 2023 Ory Corp -// SPDX-License-Identifier: Apache-2.0 - -package migrate - -import ( - "fmt" - "strconv" - - "github.com/ory/x/cmdx" - "github.com/ory/x/flagx" - "github.com/ory/x/popx" - "github.com/spf13/cobra" - - "github.com/ory/keto/internal/driver" - "github.com/ory/keto/ketoctx" -) - -func newDownCmd(opts []ketoctx.Option) *cobra.Command { - cmd := &cobra.Command{ - Use: "down ", - Short: "Migrate the database down", - Long: "Migrate the database down a specific amount of steps.\n" + - "Pass 0 steps to fully migrate down.", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - steps, err := strconv.ParseInt(args[0], 0, 0) - if err != nil { - // return this error so it gets printed along the usage - return fmt.Errorf("malformed argument %s for : %+v", args[0], err) - } - - reg, err := driver.NewDefaultRegistry(cmd.Context(), cmd.Flags(), true, opts) - if err != nil { - return err - } - - mb, err := reg.MigrationBox(cmd.Context()) - if err != nil { - return err - } - - return BoxDown(cmd, mb, int(steps)) - }, - } - - RegisterYesFlag(cmd.Flags()) - cmdx.RegisterFormatFlags(cmd.Flags()) - - return cmd -} - -func BoxDown(cmd *cobra.Command, mb *popx.MigrationBox, steps int) error { - s, err := mb.Status(cmd.Context()) - if err != nil { - _, _ = fmt.Fprintf(cmd.ErrOrStderr(), "Could not get migration status: %+v\n", err) - return cmdx.FailSilently(cmd) - } - cmdx.PrintTable(cmd, s) - - if !flagx.MustGetBool(cmd, FlagYes) && !cmdx.AskForConfirmation("Do you really want to migrate down? This will delete data.", cmd.InOrStdin(), cmd.OutOrStdout()) { - _, _ = fmt.Fprintln(cmd.OutOrStdout(), "Migration aborted.") - return nil - } - - if err := mb.Down(cmd.Context(), steps); err != nil { - _, _ = fmt.Fprintf(cmd.ErrOrStderr(), "Could apply down migrations: %+v\n", err) - return cmdx.FailSilently(cmd) - } - - s, err = mb.Status(cmd.Context()) - if err != nil { - _, _ = fmt.Fprintf(cmd.ErrOrStderr(), "Could not get migration status: %+v\n", err) - return cmdx.FailSilently(cmd) - } - cmdx.PrintTable(cmd, s) - return nil -} diff --git a/cmd/migrate/migrate_test.go b/cmd/migrate/migrate_test.go index 189ead920..65d93d882 100644 --- a/cmd/migrate/migrate_test.go +++ b/cmd/migrate/migrate_test.go @@ -79,7 +79,7 @@ func TestMigrate(t *testing.T) { cmd := newCmd(ctx, "-c", cf) - out := cmd.ExecNoErr(t, "up", "--"+FlagYes) + out := cmd.ExecNoErr(t, "up", "-y") assert.Contains(t, out, "All migrations are already applied, there is nothing to do.") }) }) @@ -132,7 +132,7 @@ func TestMigrate(t *testing.T) { t.Cleanup(func() { // migrate all down - t.Logf("cleanup:\n%s\n", cmd.ExecNoErr(t, "down", "0", "--"+FlagYes)) + t.Logf("cleanup:\n%s\n", cmd.ExecNoErr(t, "down", "--steps", "10000", "-y")) }) parts := strings.Split(stdOut, "Are you sure that you want to apply this migration?") @@ -143,11 +143,11 @@ func TestMigrate(t *testing.T) { }) t.Run("case=applies on yes flag", func(t *testing.T) { - out := cmd.ExecNoErr(t, "up", "--"+FlagYes) + out := cmd.ExecNoErr(t, "up", "-y") t.Cleanup(func() { // migrate all down - t.Logf("cleanup:\n%s\n", cmd.ExecNoErr(t, "down", "0", "--"+FlagYes)) + t.Logf("cleanup:\n%s\n", cmd.ExecNoErr(t, "down", "--steps", "10000", "-y")) }) parts := strings.Split(out, "Applying migrations...") @@ -185,8 +185,8 @@ func TestUpAndDown(t *testing.T) { config.KeyNamespaces: []*namespace.Namespace{}, }) - t.Log(cmd.ExecNoErr(t, "up", "-c", cf, "--"+FlagYes)) - t.Log(cmd.ExecNoErr(t, "down", "0", "-c", cf, "--"+FlagYes)) + t.Log(cmd.ExecNoErr(t, "up", "-c", cf, "-y")) + t.Log(cmd.ExecNoErr(t, "down", "--steps", "10000", "-c", cf, "-y")) }) } } diff --git a/cmd/migrate/root.go b/cmd/migrate/root.go index d2699b4e0..06a3152cb 100644 --- a/cmd/migrate/root.go +++ b/cmd/migrate/root.go @@ -4,26 +4,86 @@ package migrate import ( + "github.com/ory/x/configx" + "github.com/ory/x/popx" "github.com/spf13/cobra" + "github.com/ory/keto/internal/driver" + "github.com/ory/keto/ketoctx" ) +func RegisterCommandsRecursive(parent *cobra.Command, opts []ketoctx.Option) { + parent.AddCommand(newMigrateCmd(opts)) +} + +// migrateSqlCmd represents the sql command func newMigrateCmd(opts []ketoctx.Option) *cobra.Command { - cmd := &cobra.Command{ + c := &cobra.Command{ Use: "migrate", - Short: "Commands to migrate the database", - Long: "Commands to migrate the database.\n" + - "This does not affect namespaces. Use `keto namespace migrate` for migrating namespaces.", + Short: "Create SQL schemas and apply migration plans", } - cmd.AddCommand( - newStatusCmd(opts), - newUpCmd(opts), - newDownCmd(opts), - ) - return cmd + + configx.RegisterFlags(c.PersistentFlags()) + c.PersistentFlags().BoolP("read-from-env", "e", false, "If set, reads the database connection string from the environment variable DSN or config file key dsn.") + c.Flags().BoolP("yes", "y", false, "If set all confirmation requests are accepted without user interaction.") + + c.AddCommand(NewMigrateSQLStatusCmd(opts)) + c.AddCommand(NewMigrateSQLUpCmd(opts)) + c.AddCommand(NewMigrateSQLDownCmd(opts)) + + c.AddCommand(newMigrateSqlCmd(opts)) + + return c } -func RegisterCommandsRecursive(parent *cobra.Command, opts []ketoctx.Option) { - parent.AddCommand(newMigrateCmd(opts)) +// migrateSqlCmd represents the sql command +func newMigrateSqlCmd(opts []ketoctx.Option) *cobra.Command { + c := &cobra.Command{ + Use: "sql", + Short: "Create SQL schemas and apply migration plans", + } + + configx.RegisterFlags(c.PersistentFlags()) + c.PersistentFlags().BoolP("read-from-env", "e", false, "If set, reads the database connection string from the environment variable DSN or config file key dsn.") + c.Flags().BoolP("yes", "y", false, "If set all confirmation requests are accepted without user interaction.") + + c.AddCommand(NewMigrateSQLStatusCmd(opts)) + c.AddCommand(NewMigrateSQLUpCmd(opts)) + c.AddCommand(NewMigrateSQLDownCmd(opts)) + + return c +} + +func NewMigrateSQLDownCmd(opts []ketoctx.Option) *cobra.Command { + return popx.NewMigrateSQLDownCmd("keto", func(cmd *cobra.Command, args []string) error { + reg, err := driver.NewDefaultRegistry(cmd.Context(), cmd.Flags(), true, opts) + if err != nil { + return err + } + + return popx.MigrateSQLDown(cmd, reg.Persister()) + }) +} + +func NewMigrateSQLUpCmd(opts []ketoctx.Option) *cobra.Command { + return popx.NewMigrateSQLUpCmd("keto", func(cmd *cobra.Command, args []string) error { + reg, err := driver.NewDefaultRegistry(cmd.Context(), cmd.Flags(), true, opts) + if err != nil { + return err + } + + return popx.MigrateSQLUp(cmd, reg.Persister()) + }) +} + +func NewMigrateSQLStatusCmd(opts []ketoctx.Option) *cobra.Command { + return popx.NewMigrateSQLStatusCmd("keto", func(cmd *cobra.Command, args []string) error { + reg, err := driver.NewDefaultRegistry(cmd.Context(), cmd.Flags(), true, opts) + if err != nil { + return err + } + + return popx.MigrateStatus(cmd, reg.Persister()) + }) } diff --git a/cmd/migrate/status.go b/cmd/migrate/status.go deleted file mode 100644 index cbeb8b339..000000000 --- a/cmd/migrate/status.go +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright © 2023 Ory Corp -// SPDX-License-Identifier: Apache-2.0 - -package migrate - -import ( - "fmt" - "time" - - "github.com/ory/x/popx" - - "github.com/ory/x/cmdx" - "github.com/spf13/cobra" - - "github.com/ory/keto/internal/driver" - "github.com/ory/keto/ketoctx" -) - -func newStatusCmd(opts []ketoctx.Option) *cobra.Command { - block := false - cmd := &cobra.Command{ - Use: "status", - Short: "Get the current migration status", - Long: "Get the current migration status.\n" + - "This does not affect namespaces. Use `keto namespace migrate status` for migrating namespaces.", - RunE: func(cmd *cobra.Command, _ []string) error { - ctx := cmd.Context() - - reg, err := driver.NewDefaultRegistry(ctx, cmd.Flags(), true, opts) - if err != nil { - return err - } - - mb, err := reg.MigrationBox(ctx) - if err != nil { - return err - } - - s, err := mb.Status(ctx) - if err != nil { - _, _ = fmt.Fprintf(cmd.OutOrStdout(), "Could not get migration status: %+v\n", err) - return cmdx.FailSilently(cmd) - } - - for block && s.HasPending() { - _, _ = fmt.Fprintf(cmd.OutOrStdout(), "Waiting for migrations to finish...\n") - for _, m := range s { - if m.State == popx.Pending { - _, _ = fmt.Fprintf(cmd.OutOrStdout(), " - %s\n", m.Name) - } - } - select { - case <-ctx.Done(): - _, _ = fmt.Fprintln(cmd.ErrOrStderr(), "Context was canceled, exiting...") - return cmdx.FailSilently(cmd) - case <-time.After(time.Second): - } - s, err = mb.Status(ctx) - if err != nil { - _, _ = fmt.Fprintf(cmd.OutOrStdout(), "Could not get migration status: %+v\n", err) - return cmdx.FailSilently(cmd) - } - } - - cmdx.PrintTable(cmd, s) - return nil - }, - } - - cmdx.RegisterFormatFlags(cmd.Flags()) - cmd.Flags().BoolVar(&block, "block", false, "Block until all migrations have been applied") - - return cmd -} diff --git a/cmd/migrate/up.go b/cmd/migrate/up.go deleted file mode 100644 index 857a73d11..000000000 --- a/cmd/migrate/up.go +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright © 2023 Ory Corp -// SPDX-License-Identifier: Apache-2.0 - -package migrate - -import ( - "fmt" - - "github.com/ory/x/cmdx" - "github.com/ory/x/flagx" - "github.com/ory/x/popx" - "github.com/spf13/cobra" - "github.com/spf13/pflag" - - "github.com/ory/keto/internal/driver" - "github.com/ory/keto/ketoctx" -) - -const ( - FlagYes = "yes" -) - -func newUpCmd(opts []ketoctx.Option) *cobra.Command { - cmd := &cobra.Command{ - Use: "up", - Short: "Migrate the database up", - Long: `Run this command on a fresh SQL installation and when you upgrade Ory Keto from version v0.7.x and later. - -It is recommended to run this command close to the SQL instance (e.g. same subnet) instead of over the public internet. -This decreases risk of failure and decreases time required. - -### WARNING ### - -Before running this command on an existing database, create a back up! -`, - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, _ []string) error { - ctx := cmd.Context() - - reg, err := driver.NewDefaultRegistry(ctx, cmd.Flags(), true, opts) - if err != nil { - return err - } - - mb, err := reg.MigrationBox(ctx) - if err != nil { - return err - } - - if err := BoxUp(cmd, mb); err != nil { - return err - } - - return nil - }, - } - - RegisterYesFlag(cmd.Flags()) - - cmdx.RegisterFormatFlags(cmd.Flags()) - - return cmd -} - -func RegisterYesFlag(flags *pflag.FlagSet) { - flags.BoolP(FlagYes, "y", false, "yes to all questions, no user input required") -} - -func BoxUp(cmd *cobra.Command, mb *popx.MigrationBox) error { - _, _ = fmt.Fprintln(cmd.OutOrStdout(), "Current status:") - - s, err := mb.Status(cmd.Context()) - if err != nil { - _, _ = fmt.Fprintf(cmd.ErrOrStderr(), "Could not get migration status: %+v\n", err) - return cmdx.FailSilently(cmd) - } - cmdx.PrintTable(cmd, s) - - if !s.HasPending() { - _, _ = fmt.Fprintln(cmd.OutOrStdout(), "All migrations are already applied, there is nothing to do.") - return nil - } - - if !flagx.MustGetBool(cmd, FlagYes) && !cmdx.AskForConfirmation("Are you sure that you want to apply this migration? Make sure to check the CHANGELOG.md for breaking changes beforehand.", cmd.InOrStdin(), cmd.OutOrStdout()) { - _, _ = fmt.Fprintln(cmd.OutOrStdout(), "Aborting") - return nil - } - - _, _ = fmt.Fprintln(cmd.OutOrStdout(), "Applying migrations...") - - if err := mb.Up(cmd.Context()); err != nil { - _, _ = fmt.Fprintf(cmd.ErrOrStderr(), "Could not apply migrations: %+v\n", err) - return cmdx.FailSilently(cmd) - } - - _, _ = fmt.Fprintln(cmd.OutOrStdout(), "Successfully applied all migrations:") - - s, err = mb.Status(cmd.Context()) - if err != nil { - _, _ = fmt.Fprintf(cmd.ErrOrStderr(), "Could not get migration status: %+v\n", err) - return cmdx.FailSilently(cmd) - } - - cmdx.PrintTable(cmd, s) - return nil -} diff --git a/go.mod b/go.mod index 44f7e0ef5..a2beff8b4 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/ory/herodot v0.10.3-0.20230626083119-d7e5192f0d88 github.com/ory/jsonschema/v3 v3.0.8 github.com/ory/keto/proto v0.13.0-alpha.0 - github.com/ory/x v0.0.665 + github.com/ory/x v0.0.675 github.com/pelletier/go-toml v1.9.5 github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5 github.com/pkg/errors v0.9.1 @@ -39,13 +39,13 @@ require ( github.com/tidwall/sjson v1.2.5 github.com/urfave/negroni v1.0.0 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.56.0 - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 - go.opentelemetry.io/otel v1.31.0 - go.opentelemetry.io/otel/sdk v1.31.0 - go.opentelemetry.io/otel/trace v1.31.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.57.0 + go.opentelemetry.io/otel v1.32.0 + go.opentelemetry.io/otel/sdk v1.32.0 + go.opentelemetry.io/otel/trace v1.32.0 go.uber.org/goleak v1.3.0 golang.org/x/oauth2 v0.23.0 - golang.org/x/sync v0.8.0 + golang.org/x/sync v0.9.0 google.golang.org/grpc v1.67.1 google.golang.org/protobuf v1.35.1 ) @@ -104,7 +104,7 @@ require ( github.com/gorilla/css v1.0.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-retryablehttp v0.7.7 // indirect github.com/hashicorp/hcl v1.0.0 // indirect @@ -147,7 +147,7 @@ require ( github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0 // indirect github.com/opencontainers/runc v1.1.14 // indirect - github.com/openzipkin/zipkin-go v0.4.2 // indirect + github.com/openzipkin/zipkin-go v0.4.3 // indirect github.com/ory/dockertest/v3 v3.11.0 // indirect github.com/ory/go-acc v0.2.9-0.20230103102148-6b1c9a70dbbe // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect @@ -155,7 +155,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.20.4 // indirect github.com/prometheus/procfs v0.15.1 // indirect - github.com/rogpeppe/go-internal v1.11.0 // indirect + github.com/rogpeppe/go-internal v1.13.1 // indirect github.com/sagikazarmark/locafero v0.3.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/seatgeek/logrus-gelf-formatter v0.0.0-20210414080842-5b05eb8ff761 // indirect @@ -174,27 +174,27 @@ require ( github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.46.1 // indirect - go.opentelemetry.io/contrib/propagators/b3 v1.21.0 // indirect - go.opentelemetry.io/contrib/propagators/jaeger v1.21.1 // indirect - go.opentelemetry.io/contrib/samplers/jaegerremote v0.15.1 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.57.0 // indirect + go.opentelemetry.io/contrib/propagators/b3 v1.32.0 // indirect + go.opentelemetry.io/contrib/propagators/jaeger v1.32.0 // indirect + go.opentelemetry.io/contrib/samplers/jaegerremote v0.26.0 // indirect go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0 // indirect - go.opentelemetry.io/otel/exporters/zipkin v1.21.0 // indirect - go.opentelemetry.io/otel/metric v1.31.0 // indirect - go.opentelemetry.io/proto/otlp v1.0.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.32.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.32.0 // indirect + go.opentelemetry.io/otel/exporters/zipkin v1.32.0 // indirect + go.opentelemetry.io/otel/metric v1.32.0 // indirect + go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/mod v0.19.0 // indirect golang.org/x/net v0.30.0 // indirect - golang.org/x/sys v0.26.0 // indirect - golang.org/x/text v0.19.0 // indirect + golang.org/x/sys v0.27.0 // indirect + golang.org/x/text v0.20.0 // indirect golang.org/x/tools v0.23.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 4248fdca7..dedb4efa8 100644 --- a/go.sum +++ b/go.sum @@ -178,8 +178,6 @@ github.com/gobuffalo/github_flavored_markdown v1.1.4 h1:WacrEGPXUDX+BpU1GM/Y0ADg github.com/gobuffalo/github_flavored_markdown v1.1.4/go.mod h1:Vl9686qrVVQou4GrHRK/KOG3jCZOKLUqV8MMOAYtlso= github.com/gobuffalo/helpers v0.6.7 h1:C9CedoRSfgWg2ZoIkVXgjI5kgmSpL34Z3qdnzpfNVd8= github.com/gobuffalo/helpers v0.6.7/go.mod h1:j0u1iC1VqlCaJEEVkZN8Ia3TEzfj/zoXANqyJExTMTA= -github.com/gobuffalo/here v0.6.7 h1:hpfhh+kt2y9JLDfhYUxxCRxQol540jsVfKUZzjlbp8o= -github.com/gobuffalo/here v0.6.7/go.mod h1:vuCfanjqckTuRlqAitJz6QC4ABNnS27wLb816UhsPcc= github.com/gobuffalo/httptest v1.5.2 h1:GpGy520SfY1QEmyPvaqmznTpG4gEQqQ82HtHqyNEreM= github.com/gobuffalo/httptest v1.5.2/go.mod h1:FA23yjsWLGj92mVV74Qtc8eqluc11VqcWr8/C1vxt4g= github.com/gobuffalo/logger v1.0.7/go.mod h1:u40u6Bq3VVvaMcy5sRBclD8SXhBYPS0Qk95ubt+1xJM= @@ -288,8 +286,8 @@ github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 h1:pRhl55Yx1eC7BZ1N+BBWwn github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0/go.mod h1:XKMd7iuf/RGPSMJ/U4HP0zS2Z9Fh8Ps9a+6X26m/tmI= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 h1:6UKoz5ujsI55KNpsJH3UwCq3T8kKbZwNZBNPuTTje8U= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1/go.mod h1:YvJ2f6MplWDhfxiUC3KpyTy76kYUZA4W3pTv/wdKQ9Y= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0 h1:ad0vkEBuk23VJzZR9nkLVG0YAoN9coASF1GusYX6AlU= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0/go.mod h1:igFoXX2ELCW06bol23DWPB5BEWfZISOzSP5K2sbLea0= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= @@ -424,8 +422,6 @@ github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0V github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/markbates/pkger v0.17.1 h1:/MKEtWqtc0mZvu9OinB9UzVN9iYCwLWuyUv4Bw+PCno= -github.com/markbates/pkger v0.17.1/go.mod h1:0JoVlrol20BSywW79rN3kdFFsE5xYM+rSCQDXbLhiuI= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= @@ -471,8 +467,8 @@ github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQ github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= github.com/opencontainers/runc v1.1.14 h1:rgSuzbmgz5DUJjeSnw337TxDbRuqjs6iqQck/2weR6w= github.com/opencontainers/runc v1.1.14/go.mod h1:E4C2z+7BxR7GHXp0hAY53mek+x49X1LjPNeMTfRGvOA= -github.com/openzipkin/zipkin-go v0.4.2 h1:zjqfqHjUpPmB3c1GlCvvgsM1G4LkvqQbBDueDOCg/jA= -github.com/openzipkin/zipkin-go v0.4.2/go.mod h1:ZeVkFjuuBiSy13y8vpSDCjMi9GoI3hPpCJSBx/EYFhY= +github.com/openzipkin/zipkin-go v0.4.3 h1:9EGwpqkgnwdEIJ+Od7QVSEIH+ocmm5nPat0G7sjsSdg= +github.com/openzipkin/zipkin-go v0.4.3/go.mod h1:M9wCJZFWCo2RiY+o1eBCEMe0Dp2S5LDHcMZmk3RmK7c= github.com/ory/analytics-go/v5 v5.0.1 h1:LX8T5B9FN8KZXOtxgN+R3I4THRRVB6+28IKgKBpXmAM= github.com/ory/analytics-go/v5 v5.0.1/go.mod h1:lWCiCjAaJkKfgR/BN5DCLMol8BjKS1x+4jxBxff/FF0= github.com/ory/dockertest/v3 v3.11.0 h1:OiHcxKAvSDUwsEVh2BjxQQc/5EHz9n0va9awCtNGuyA= @@ -485,8 +481,8 @@ github.com/ory/herodot v0.10.3-0.20230626083119-d7e5192f0d88 h1:J0CIFKdpUeqKbVMw github.com/ory/herodot v0.10.3-0.20230626083119-d7e5192f0d88/go.mod h1:MMNmY6MG1uB6fnXYFaHoqdV23DTWctlPsmRCeq/2+wc= github.com/ory/jsonschema/v3 v3.0.8 h1:Ssdb3eJ4lDZ/+XnGkvQS/te0p+EkolqwTsDOCxr/FmU= github.com/ory/jsonschema/v3 v3.0.8/go.mod h1:ZPzqjDkwd3QTnb2Z6PAS+OTvBE2x5i6m25wCGx54W/0= -github.com/ory/x v0.0.665 h1:61vv0ObCDSX1vOQYbxBeqDiv4YiPmMT91lYxDaaKX08= -github.com/ory/x v0.0.665/go.mod h1:7SCTki3N0De3ZpqlxhxU/94ZrOCfNEnXwVtd0xVt+L8= +github.com/ory/x v0.0.675 h1:K6GpVo99BXBFv2UiwMjySNNNqCFKGswynrt7vWQJFU8= +github.com/ory/x v0.0.675/go.mod h1:zJmnDtKje2FCP4EeFvRsKk94XXiqKCSGJMZcirAfhUs= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= @@ -515,8 +511,8 @@ github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoG github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= @@ -624,34 +620,34 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.56.0 h1:yMkBS9yViCc7U7yeLzJPM2XizlfdVvBRSmsQDWu6qc0= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.56.0/go.mod h1:n8MR6/liuGB5EmTETUBeU5ZgqMOlqKRxUaqPQBOANZ8= -go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.46.1 h1:gbhw/u49SS3gkPWiYweQNJGm/uJN5GkI/FrosxSHT7A= -go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.46.1/go.mod h1:GnOaBaFQ2we3b9AGWJpsBa7v1S5RlQzlC3O7dRMxZhM= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= -go.opentelemetry.io/contrib/propagators/b3 v1.21.0 h1:uGdgDPNzwQWRwCXJgw/7h29JaRqcq9B87Iv4hJDKAZw= -go.opentelemetry.io/contrib/propagators/b3 v1.21.0/go.mod h1:D9GQXvVGT2pzyTfp1QBOnD1rzKEWzKjjwu5q2mslCUI= -go.opentelemetry.io/contrib/propagators/jaeger v1.21.1 h1:f4beMGDKiVzg9IcX7/VuWVy+oGdjx3dNJ72YehmtY5k= -go.opentelemetry.io/contrib/propagators/jaeger v1.21.1/go.mod h1:U9jhkEl8d1LL+QXY7q3kneJWJugiN3kZJV2OWz3hkBY= -go.opentelemetry.io/contrib/samplers/jaegerremote v0.15.1 h1:Qb+5A+JbIjXwO7l4HkRUhgIn4Bzz0GNS2q+qdmSx+0c= -go.opentelemetry.io/contrib/samplers/jaegerremote v0.15.1/go.mod h1:G4vNCm7fRk0kjZ6pGNLo5SpLxAUvOfSrcaegnT8TPck= -go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= -go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= +go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.57.0 h1:7F3XCD6WYzDkwbi8I8N+oYJWquPVScnRosKGgqjsR8c= +go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.57.0/go.mod h1:Dk3C0BfIlZDZ5c6eVS7TYiH2vssuyUU3vUsgbrR+5V4= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.57.0 h1:DheMAlT6POBP+gh8RUH19EOTnQIor5QE0uSRPtzCpSw= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.57.0/go.mod h1:wZcGmeVO9nzP67aYSLDqXNWK87EZWhi7JWj1v7ZXf94= +go.opentelemetry.io/contrib/propagators/b3 v1.32.0 h1:MazJBz2Zf6HTN/nK/s3Ru1qme+VhWU5hm83QxEP+dvw= +go.opentelemetry.io/contrib/propagators/b3 v1.32.0/go.mod h1:B0s70QHYPrJwPOwD1o3V/R8vETNOG9N3qZf4LDYvA30= +go.opentelemetry.io/contrib/propagators/jaeger v1.32.0 h1:K/fOyTMD6GELKTIJBaJ9k3ppF2Njt8MeUGBOwfaWXXA= +go.opentelemetry.io/contrib/propagators/jaeger v1.32.0/go.mod h1:ISE6hda//MTWvtngG7p4et3OCngsrTVfl7c6DjN17f8= +go.opentelemetry.io/contrib/samplers/jaegerremote v0.26.0 h1:/SKXyZLAnuj981HVc8G5ZylYK3qD2W6AYR6cJx5kIHw= +go.opentelemetry.io/contrib/samplers/jaegerremote v0.26.0/go.mod h1:cOEzME0M2OKeHB45lJiOKfvUCdg/r75mf7YS5w0tbmE= +go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= +go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= go.opentelemetry.io/otel/exporters/jaeger v1.17.0 h1:D7UpUy2Xc2wsi1Ras6V40q806WM07rqoCWzXu7Sqy+4= go.opentelemetry.io/otel/exporters/jaeger v1.17.0/go.mod h1:nPCqOnEH9rNLKqH/+rrUjiMzHJdV1BlpKcTwRTyKkKI= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 h1:cl5P5/GIfFh4t6xyruOgJP5QiA1pw4fYYdv6nc6CBWw= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0/go.mod h1:zgBdWWAu7oEEMC06MMKc5NLbA/1YDXV1sMpSqEeLQLg= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0 h1:digkEZCJWobwBqMwC0cwCq8/wkkRy/OowZg5OArWZrM= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0/go.mod h1:/OpE/y70qVkndM0TrxT4KBoN3RsFZP0QaofcfYrj76I= -go.opentelemetry.io/otel/exporters/zipkin v1.21.0 h1:D+Gv6lSfrFBWmQYyxKjDd0Zuld9SRXpIrEsKZvE4DO4= -go.opentelemetry.io/otel/exporters/zipkin v1.21.0/go.mod h1:83oMKR6DzmHisFOW3I+yIMGZUTjxiWaiBI8M8+TU5zE= -go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= -go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= -go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk= -go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0= -go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= -go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= -go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= -go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.32.0 h1:IJFEoHiytixx8cMiVAO+GmHR6Frwu+u5Ur8njpFO6Ac= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.32.0/go.mod h1:3rHrKNtLIoS0oZwkY2vxi+oJcwFRWdtUyRII+so45p8= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.32.0 h1:cMyu9O88joYEaI47CnQkxO1XZdpoTF9fEnW2duIddhw= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.32.0/go.mod h1:6Am3rn7P9TVVeXYG+wtcGE7IE1tsQ+bP3AuWcKt/gOI= +go.opentelemetry.io/otel/exporters/zipkin v1.32.0 h1:6O8HgLHPXtXE9QEKEWkBImL9mEKCGEl+m+OncVO53go= +go.opentelemetry.io/otel/exporters/zipkin v1.32.0/go.mod h1:+MFvorlowjy0iWnsKaNxC1kzczSxe71mw85h4p8yEvg= +go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= +go.opentelemetry.io/otel/metric v1.32.0/go.mod h1:jH7CIbbK6SH2V2wE16W05BHCtIDzauciCRLoc/SyMv8= +go.opentelemetry.io/otel/sdk v1.32.0 h1:RNxepc9vK59A8XsgZQouW8ue8Gkb4jpWtJm9ge5lEG4= +go.opentelemetry.io/otel/sdk v1.32.0/go.mod h1:LqgegDBjKMmb2GC6/PrTnteJG39I8/vJCAP9LlJXEjU= +go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQDe03fM= +go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8= +go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= +go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -785,8 +781,8 @@ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= +golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -840,8 +836,8 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= +golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -856,8 +852,8 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= -golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= +golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -990,10 +986,10 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= -google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 h1:QCqS/PdaHTSWGvupk2F/ehwHtGc0/GYkT+3GAcR1CCc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= +google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 h1:M0KvPgPmDZHPlbRbaNU1APr28TvwvvdUPlSv7PUvy8g= +google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:dguCy7UOdZhTvLzDyt15+rOrawrpM4q7DD9dQ1P11P4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 h1:XVhgTWWV3kGQlwJHR3upFWZeTsei6Oks1apkZSeonIE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/internal/driver/registry_default.go b/internal/driver/registry_default.go index 928ce0398..92d3d53df 100644 --- a/internal/driver/registry_default.go +++ b/internal/driver/registry_default.go @@ -283,12 +283,20 @@ func (r *RegistryDefault) MigrateUp(ctx context.Context) error { return r.Init(ctx) } -func (r *RegistryDefault) MigrateDown(ctx context.Context) error { +func (r *RegistryDefault) MigrateDown(ctx context.Context, i int) error { mb, err := r.MigrationBox(ctx) if err != nil { return err } - return mb.Down(ctx, -1) + return mb.Down(ctx, i) +} + +func (r *RegistryDefault) MigrationStatus(ctx context.Context) (popx.MigrationStatuses, error) { + mb, err := r.MigrationBox(ctx) + if err != nil { + return nil, err + } + return mb.Status(ctx) } func (r *RegistryDefault) DetermineNetwork(ctx context.Context) (*networkx.Network, error) { diff --git a/internal/persistence/definitions.go b/internal/persistence/definitions.go index 876504090..98e33b50c 100644 --- a/internal/persistence/definitions.go +++ b/internal/persistence/definitions.go @@ -19,6 +19,7 @@ type ( Persister interface { relationtuple.Manager relationtuple.MappingManager + Migrator Connection(ctx context.Context) *pop.Connection NetworkID(ctx context.Context) uuid.UUID @@ -26,9 +27,7 @@ type ( Transaction(ctx context.Context, f func(ctx context.Context) error) error } Migrator interface { - MigrationBox(ctx context.Context) (*popx.MigrationBox, error) - MigrateUp(ctx context.Context) error - MigrateDown(ctx context.Context) error + popx.MigrationProvider } Provider interface { Persister() Persister diff --git a/internal/persistence/sql/persister.go b/internal/persistence/sql/persister.go index 7fd5d94f6..4b213214d 100644 --- a/internal/persistence/sql/persister.go +++ b/internal/persistence/sql/persister.go @@ -25,6 +25,8 @@ type ( conn *pop.Connection d dependencies nid uuid.UUID + mb *popx.MigrationBox + mbs popx.MigrationStatuses } internalPagination struct { PerPage int @@ -34,6 +36,7 @@ type ( x.LoggerProvider x.TracingProvider ketoctx.ContextualizerProvider + persistence.Migrator config.Provider PopConnection(ctx context.Context) (*pop.Connection, error) @@ -104,6 +107,18 @@ func (p *Persister) SetNetwork(nid uuid.UUID) { p.nid = nid } +func (p *Persister) MigrateUp(ctx context.Context) error { + return p.d.MigrateUp(ctx) +} + +func (p *Persister) MigrateDown(ctx context.Context, i int) error { + return p.d.MigrateDown(ctx, i) +} + +func (p *Persister) MigrationStatus(ctx context.Context) (popx.MigrationStatuses, error) { + return p.d.MigrationStatus(ctx) +} + func internalPaginationFromOptions(opts ...x.PaginationOptionSetter) (*internalPagination, error) { xp := x.GetPaginationOptions(opts...) ip := &internalPagination{