graphql-engine/cli/commands/scripts_upgrade_multiple_sources.go
hasura-bot a398d3b190 cli: support datasources
GITHUB_PR_NUMBER: 6111
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/6111

Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: 1f6517acfacb58c566bb5e48f74ea0dfa5c6f063
2021-01-18 17:12:09 +00:00

43 lines
1.1 KiB
Go

package commands
import (
"github.com/hasura/graphql-engine/cli/internal/scripts"
"github.com/spf13/afero"
"github.com/hasura/graphql-engine/cli"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
func newUpdateMultipleSources(ec *cli.ExecutionContext) *cobra.Command {
v := viper.New()
cmd := &cobra.Command{
Use: "update-project-v3",
Short: "update project to use config v2 to config v3",
Long: `
`,
Example: ` `,
SilenceUsage: true,
PreRunE: func(cmd *cobra.Command, args []string) error {
ec.Viper = v
err := ec.Prepare()
if err != nil {
return err
}
return ec.Validate()
},
RunE: func(cmd *cobra.Command, args []string) error {
opts := scripts.UpgradeToMuUpgradeProjectToMultipleSourcesOpts{
Fs: afero.NewOsFs(),
ProjectDirectory: ec.ExecutionDirectory,
MigrationsAbsDirectoryPath: ec.MigrationDir,
SeedsAbsDirectoryPath: ec.SeedsDirectory,
Logger: ec.Logger,
EC: ec,
}
return scripts.UpgradeProjectToMultipleSources(opts)
},
}
return cmd
}