Skip to content

Commit

Permalink
cli: mark cockroach zone commands as deprecated
Browse files Browse the repository at this point in the history
Requested/suggested by @benesch: this patch makes the various
`cockroach zone` sub-commands report a deprecation warning and a
reference to the new SQL interface:

```
$ cockroach zone ls
Command "ls" is deprecated, use SHOW ZONE CONFIGURATIONS in a SQL client instead.

$ cockroach zone get .default
Command "get" is deprecated, use SHOW ZONE CONFIGURATION FOR ... in a SQL client instead.

$ cockroach zone set .default
Command "set" is deprecated, use ALTER ... CONFIGURE ZONE in a SQL client instead.

$ cockroach zone rm liveness
Command "rm" is deprecated, use ALTER ... CONFIGURE ZONE DISCARD in a SQL client instead.
```

Release note (cli change): The various `cockroach zone` sub-commands
are now deprecated and will be removed in a future version of
CockroachDB. Clients should use the SQL interface instead via `SHOW
ZONE CONFIGURATION(s)` or `ALTER ... CONFIGURE ZONE`.
  • Loading branch information
knz committed Sep 5, 2018
1 parent a7dbffd commit bfc190d
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions pkg/cli/zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ var getZoneCmd = &cobra.Command{
Fetches and displays the zone configuration for the specified database or
table.
`,
Args: cobra.ExactArgs(1),
RunE: MaybeDecorateGRPCError(runGetZone),
Args: cobra.ExactArgs(1),
RunE: MaybeDecorateGRPCError(runGetZone),
Deprecated: "use SHOW ZONE CONFIGURATION FOR ... in a SQL client instead.",
}

// runGetZone retrieves the zone config for a given object id,
Expand Down Expand Up @@ -126,8 +127,9 @@ var lsZonesCmd = &cobra.Command{
Long: `
List zone configs.
`,
Args: cobra.NoArgs,
RunE: MaybeDecorateGRPCError(runLsZones),
Args: cobra.NoArgs,
RunE: MaybeDecorateGRPCError(runLsZones),
Deprecated: "use SHOW ZONE CONFIGURATIONS in a SQL client instead.",
}

func runLsZones(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -179,8 +181,9 @@ var rmZoneCmd = &cobra.Command{
Long: `
Remove an existing zone config for the specified database or table.
`,
Args: cobra.ExactArgs(1),
RunE: MaybeDecorateGRPCError(runRmZone),
Args: cobra.ExactArgs(1),
RunE: MaybeDecorateGRPCError(runRmZone),
Deprecated: "use ALTER ... CONFIGURE ZONE DISCARD in a SQL client instead.",
}

func runRmZone(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -236,8 +239,9 @@ EOF
Note that the specified zone config is merged with the existing zone config for
the database or table.
`,
Args: cobra.ExactArgs(1),
RunE: MaybeDecorateGRPCError(runSetZone),
Args: cobra.ExactArgs(1),
RunE: MaybeDecorateGRPCError(runSetZone),
Deprecated: "use ALTER ... CONFIGURE ZONE in a SQL client instead.",
}

func readZoneConfig() (conf []byte, err error) {
Expand Down

0 comments on commit bfc190d

Please sign in to comment.