only allow update-tag on format __DOLT__

This commit is contained in:
Dhruv Sringari
2022-11-18 13:28:29 -08:00
parent 60350928fe
commit b1e80b686b
2 changed files with 24 additions and 0 deletions

View File

@@ -25,6 +25,7 @@ import (
"github.com/dolthub/dolt/go/libraries/doltcore/env"
"github.com/dolthub/dolt/go/libraries/doltcore/schema"
"github.com/dolthub/dolt/go/libraries/utils/argparser"
"github.com/dolthub/dolt/go/store/types"
)
var updateTagDocs = cli.CommandDocumentationContent{
@@ -69,6 +70,11 @@ func (cmd UpdateTagCmd) Exec(ctx context.Context, commandStr string, args []stri
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, updateTagDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)
if !types.IsFormat_DOLT(dEnv.DoltDB.Format()) {
verr := errhand.BuildDError("update-tag is only available in storage format __DOLT__").Build()
return commands.HandleVErrAndExitCode(verr, usage)
}
if len(apr.Args) != 3 {
verr := errhand.BuildDError("must provide <table> <column> <tag>").Build()
return commands.HandleVErrAndExitCode(verr, usage)

View File

@@ -291,6 +291,24 @@ DELIM
[[ $output =~ "col1 | 10186" ]] || false
}
@test "column_tags: update-tag only available on __DOLT__" {
mkdir ld
mkdir dev
cd ld
DOLT_DEFAULT_BIN_FORMAT=__LD_1__ dolt init
run dolt schema update-tag t col 5
[ $status -ne 0 ]
echo $output
[[ $output =~ "update-tag is only available in storage format __DOLT__" ]] || false
cd ../dev
DOLT_DEFAULT_BIN_FORMAT=__DOLT_DEV__ dolt init
run dolt schema update-tag t col 5
[ $status -ne 0 ]
[[ $output =~ "update-tag is only available in storage format __DOLT__" ]] || false
}
@test "column_tags: update-tag updates a columns tag" {
skip_nbf_not_dolt