mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 17:31:56 +03:00
b875d95a75
Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com> GitOrigin-RevId: 8f6791d5fd51d011623361ac2f5994c8badb50bf
40 lines
1.0 KiB
Go
40 lines
1.0 KiB
Go
package commands
|
|
|
|
import (
|
|
"github.com/hasura/graphql-engine/cli"
|
|
"github.com/hasura/graphql-engine/cli/internal/metadataobject"
|
|
"github.com/pkg/errors"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func newMetadataInconsistencyDropCmd(ec *cli.ExecutionContext) *cobra.Command {
|
|
opts := &metadataInconsistencyDropOptions{
|
|
EC: ec,
|
|
}
|
|
metadataInconsistencyDropCmd := &cobra.Command{
|
|
Use: "drop",
|
|
Short: "Drop inconsistent objects from the metadata",
|
|
SilenceUsage: true,
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
opts.EC.Spin("Dropping inconsistent metadata...")
|
|
err := opts.run()
|
|
opts.EC.Spinner.Stop()
|
|
if err != nil {
|
|
return errors.Wrap(err, "failed to drop inconsistent metadata")
|
|
}
|
|
opts.EC.Logger.Info("all inconsistent objects removed from metadata")
|
|
return nil
|
|
},
|
|
}
|
|
|
|
return metadataInconsistencyDropCmd
|
|
}
|
|
|
|
type metadataInconsistencyDropOptions struct {
|
|
EC *cli.ExecutionContext
|
|
}
|
|
|
|
func (o *metadataInconsistencyDropOptions) run() error {
|
|
return metadataobject.NewHandlerFromEC(o.EC).DropInconsistentMetadata()
|
|
}
|