From 09b581deeb9b5fe987aabed82f2cc6f88bd21c7f Mon Sep 17 00:00:00 2001 From: Andrew Farries Date: Thu, 5 Dec 2024 15:47:54 +0000 Subject: [PATCH] Remove `pgroll sql` subcommand The `pgroll sql` subcommand adds a dependency on the `sql2pgroll` package which requires `cgo` due to the `pg_query_go` dependency. Remove this subcommand until we're able to cross-compile `pgroll` with `cgo` enabled as part of the release process. --- cmd/root.go | 1 - cmd/sql.go | 39 --------------------------------------- 2 files changed, 40 deletions(-) delete mode 100644 cmd/sql.go diff --git a/cmd/root.go b/cmd/root.go index e65ebef0..7dd51cef 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -79,7 +79,6 @@ func Execute() error { rootCmd.AddCommand(migrateCmd()) rootCmd.AddCommand(pullCmd()) rootCmd.AddCommand(latestCmd()) - rootCmd.AddCommand(sqlCmd()) return rootCmd.Execute() } diff --git a/cmd/sql.go b/cmd/sql.go deleted file mode 100644 index da095328..00000000 --- a/cmd/sql.go +++ /dev/null @@ -1,39 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 - -package cmd - -import ( - "encoding/json" - "fmt" - "os" - - "github.com/spf13/cobra" - "github.com/xataio/pgroll/pkg/sql2pgroll" -) - -func sqlCmd() *cobra.Command { - sqlCmd := &cobra.Command{ - Use: "sql ", - Short: "Convert SQL statements to pgroll operations", - Args: cobra.ExactArgs(1), - Hidden: true, - RunE: func(cmd *cobra.Command, args []string) error { - sql := args[0] - - ops, err := sql2pgroll.Convert(sql) - if err != nil { - return fmt.Errorf("failed to convert SQL statement: %w", err) - } - - enc := json.NewEncoder(os.Stdout) - enc.SetIndent("", " ") - if err := enc.Encode(ops); err != nil { - return fmt.Errorf("failed to encode operations: %w", err) - } - - return nil - }, - } - - return sqlCmd -}