mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 09:22:43 +03:00
b875d95a75
Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com> GitOrigin-RevId: 8f6791d5fd51d011623361ac2f5994c8badb50bf
37 lines
1006 B
Go
37 lines
1006 B
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 newMetadataInconsistencyStatusCmd(ec *cli.ExecutionContext) *cobra.Command {
|
|
opts := &metadataInconsistencyListOptions{
|
|
EC: ec,
|
|
}
|
|
|
|
metadataInconsistencyStatusCmd := &cobra.Command{
|
|
Use: "status",
|
|
Short: "Check if the metadata is inconsistent or not",
|
|
SilenceUsage: true,
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
opts.EC.Spin("reading metadata status...")
|
|
err := opts.read(metadataobject.NewHandlerFromEC(ec))
|
|
opts.EC.Spinner.Stop()
|
|
if err != nil {
|
|
return errors.Wrap(err, "failed to read metadata status")
|
|
}
|
|
if opts.isConsistent {
|
|
opts.EC.Logger.Println("metadata is consistent")
|
|
} else {
|
|
return errors.New("metadata is inconsistent, use list command to see the objects")
|
|
}
|
|
return nil
|
|
},
|
|
}
|
|
|
|
return metadataInconsistencyStatusCmd
|
|
}
|