Skip to content

Commit

Permalink
Add DDL for dropping sequence and auto_increment
Browse files Browse the repository at this point in the history
Signed-off-by: David Piegza <[email protected]>
  • Loading branch information
davidpiegza committed Aug 25, 2023
1 parent 6b8851d commit 2340a4d
Show file tree
Hide file tree
Showing 7 changed files with 5,138 additions and 5,133 deletions.
4 changes: 4 additions & 0 deletions go/vt/sqlparser/ast_format.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,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
4 changes: 4 additions & 0 deletions go/vt/sqlparser/ast_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1129,8 +1129,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 @@ -68,7 +68,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"

// Partition and subpartition type strings
HashTypeStr = "hash"
Expand Down Expand Up @@ -452,7 +454,9 @@ const (
AddColVindexDDLAction
DropColVindexDDLAction
AddSequenceDDLAction
DropSequenceDDLAction
AddAutoIncDDLAction
DropAutoIncDDLAction
RevertDDLAction
)

Expand Down
Loading

0 comments on commit 2340a4d

Please sign in to comment.