Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VSchema DDL support for dropping sequence and auto increment #13882

Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions go/vt/sqlparser/ast_format.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,12 @@ func (node *AlterVschema) Format(buf *TrackedBuffer) {
buf.astPrintf(node, "alter vschema on %v drop vindex %v", node.Table, node.VindexSpec.Name)
case AddSequenceDDLAction:
buf.astPrintf(node, "alter vschema add sequence %v", node.Table)
case DropSequenceDDLAction:
buf.astPrintf(node, "alter vschema drop sequence %v", node.Table)
case AddAutoIncDDLAction:
buf.astPrintf(node, "alter vschema on %v add auto_increment %v", node.Table, node.AutoIncSpec)
case DropAutoIncDDLAction:
buf.astPrintf(node, "alter vschema on %v drop auto_increment %v", node.Table, node.AutoIncSpec)
default:
buf.astPrintf(node, "%s table %v", node.Action.ToString(), node.Table)
}
Expand Down
8 changes: 8 additions & 0 deletions go/vt/sqlparser/ast_format_fast.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions go/vt/sqlparser/ast_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1262,8 +1262,12 @@ func (action DDLAction) ToString() string {
return DropColVindexStr
case AddSequenceDDLAction:
return AddSequenceStr
case DropSequenceDDLAction:
return DropSequenceStr
case AddAutoIncDDLAction:
return AddAutoIncStr
case DropAutoIncDDLAction:
return DropAutoIncStr
default:
return "Unknown DDL Action"
}
Expand Down
4 changes: 4 additions & 0 deletions go/vt/sqlparser/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ const (
AddColVindexStr = "on table add vindex"
DropColVindexStr = "on table drop vindex"
AddSequenceStr = "add sequence"
DropSequenceStr = "drop sequence"
AddAutoIncStr = "add auto_increment"
DropAutoIncStr = "drop auto_increment"

// ALTER TABLE ALGORITHM string.
DefaultStr = "default"
Expand Down Expand Up @@ -489,7 +491,9 @@ const (
AddColVindexDDLAction
DropColVindexDDLAction
AddSequenceDDLAction
DropSequenceDDLAction
AddAutoIncDDLAction
DropAutoIncDDLAction
RevertDDLAction
)

Expand Down
Loading