Skip to content

Commit

Permalink
[CR] Use cobra.ExactArgs, SQL IF [NOT] EXISTS
Browse files Browse the repository at this point in the history
  • Loading branch information
arielshaqed committed Nov 17, 2020
1 parent 84a50ab commit 6985dba
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
8 changes: 2 additions & 6 deletions cmd/lakectl/cmd/export.go
Expand Up @@ -23,10 +23,8 @@ var exportSetCmd = &cobra.Command{
Short: "set continuous export configuration for branch",
Long: `Set the entire continuous export configuration for branch.
Overrides all fields of any previous configuration.`,
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
if len(args) != 1 {
Die(`must specify "set <branch uri>"`, 1)
}
client := getClient()
branchURI := uri.Must(uri.Parse(args[0]))
exportPath, err := cmd.Flags().GetString("path")
Expand Down Expand Up @@ -70,10 +68,8 @@ Last Keys In Prefix Regexp: {{.Configuration.LastKeysInPrefixRegexp}}
var exportGetCmd = &cobra.Command{
Use: "get <branch uri>",
Short: "get continuous export configuration for branch",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
if len(args) != 1 {
Die(`must specify "get <branch uri>"`, 1)
}
client := getClient()
branchURI := uri.Must(uri.Parse(args[0]))
configuration, err := client.GetContinuousExport(context.Background(), branchURI.Repository, branchURI.Ref)
Expand Down
1 change: 1 addition & 0 deletions ddl/000012_export_continuous.down.sql
@@ -0,0 +1 @@
ALTER TABLE catalog_branches_export DROP COLUMN IF EXISTS continuous;
2 changes: 1 addition & 1 deletion ddl/000012_export_continuous.up.sql
@@ -1,6 +1,6 @@
BEGIN;

ALTER TABLE catalog_branches_export ADD COLUMN continuous BOOLEAN;
ALTER TABLE catalog_branches_export ADD COLUMN IF NOT EXISTS continuous BOOLEAN;
UPDATE catalog_branches_export SET continuous=false;
ALTER TABLE catalog_branches_export ALTER COLUMN continuous SET NOT NULL;

Expand Down
1 change: 0 additions & 1 deletion ddl/0012_export_continuous.down.sql

This file was deleted.

0 comments on commit 6985dba

Please sign in to comment.