MCPcopy
hub / github.com/ory/hydra / makeMigrationManager

Method makeMigrationManager

cmd/cli/handler_migrate.go:29–56  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

27}
28
29func (h *MigrateHandler) makeMigrationManager(cmd *cobra.Command, args []string) (*sql.MigrationManager, error) {
30 opts := append([]driver.OptionsModifier{
31 driver.WithConfigOptions(
32 configx.SkipValidation(),
33 configx.WithFlags(cmd.Flags())),
34 driver.DisableValidation(),
35 driver.DisablePreloading(),
36 driver.SkipNetworkInit(),
37 }, h.dOpts...)
38 if len(args) > 0 {
39 opts = append(opts, driver.WithConfigOptions(
40 configx.WithValue(config.KeyDSN, args[0]),
41 ))
42 }
43
44 d, err := driver.New(
45 cmd.Context(),
46 opts...)
47 if err != nil {
48 return nil, err
49 }
50 if len(d.Config().DSN()) == 0 {
51 _, _ = fmt.Fprintln(cmd.ErrOrStderr(), "No DSN provided. Please provide a DSN as the first argument or set the DSN environment variable.")
52 return nil, cmdx.FailSilently(cmd)
53 }
54
55 return d.Migrator(), nil
56}
57
58func (h *MigrateHandler) MigrateSQLUp(cmd *cobra.Command, args []string) (err error) {
59 p, err := h.makeMigrationManager(cmd, args)

Callers 3

MigrateSQLUpMethod · 0.95
MigrateSQLDownMethod · 0.95
MigrateStatusMethod · 0.95

Calls 9

WithConfigOptionsFunction · 0.92
DisableValidationFunction · 0.92
DisablePreloadingFunction · 0.92
SkipNetworkInitFunction · 0.92
NewFunction · 0.92
SkipValidationMethod · 0.80
DSNMethod · 0.80
MigratorMethod · 0.80
ConfigMethod · 0.65

Tested by

no test coverage detected