Skip to content

Commit

Permalink
wip: Extend VSchema DDL to add/drop columns
Browse files Browse the repository at this point in the history
Signed-off-by: David Piegza <[email protected]>
  • Loading branch information
davidpiegza committed Sep 22, 2023
1 parent a8f601d commit 6383f45
Show file tree
Hide file tree
Showing 14 changed files with 8,042 additions and 7,900 deletions.
2 changes: 2 additions & 0 deletions go/vt/sqlparser/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ type (

// AutoIncSpec is set for AddAutoIncDDLAction.
AutoIncSpec *AutoIncSpec

AlterOptions []AlterOption
}

// ShowMigrationLogs represents a SHOW VITESS_MIGRATION '<uuid>' LOGS statement
Expand Down
1 change: 1 addition & 0 deletions go/vt/sqlparser/ast_clone.go

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

12 changes: 11 additions & 1 deletion go/vt/sqlparser/ast_copy_on_rewrite.go

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

3 changes: 2 additions & 1 deletion go/vt/sqlparser/ast_equals.go

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

2 changes: 2 additions & 0 deletions go/vt/sqlparser/ast_format.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ func (node *AlterVschema) Format(buf *TrackedBuffer) {
buf.astPrintf(node, "alter vschema add table %v", node.Table)
case DropVschemaTableDDLAction:
buf.astPrintf(node, "alter vschema drop table %v", node.Table)
case AlterVschemaTableDDLAction:
buf.astPrintf(node, "alter vschema table %v", node.Table)
case AddColVindexDDLAction:
buf.astPrintf(node, "alter vschema on %v add vindex %v (", node.Table, node.VindexSpec.Name)
for i, col := range node.VindexCols {
Expand Down
3 changes: 3 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.

2 changes: 2 additions & 0 deletions go/vt/sqlparser/ast_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,8 @@ func (action DDLAction) ToString() string {
return AddVschemaTableStr
case DropVschemaTableDDLAction:
return DropVschemaTableStr
case AlterVschemaTableDDLAction:
return AlterVschemaTableStr
case AddColVindexDDLAction:
return AddColVindexStr
case DropColVindexDDLAction:
Expand Down
9 changes: 9 additions & 0 deletions go/vt/sqlparser/ast_rewrite.go

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

5 changes: 5 additions & 0 deletions go/vt/sqlparser/ast_visit.go

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

11 changes: 10 additions & 1 deletion go/vt/sqlparser/cached_size.go

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

32 changes: 17 additions & 15 deletions go/vt/sqlparser/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,22 @@ const (
VariableStr = "variable"

// DDL strings.
CreateStr = "create"
AlterStr = "alter"
DeallocateStr = "deallocate"
DropStr = "drop"
RenameStr = "rename"
TruncateStr = "truncate"
FlushStr = "flush"
CreateVindexStr = "create vindex"
DropVindexStr = "drop vindex"
AddVschemaTableStr = "add vschema table"
DropVschemaTableStr = "drop vschema table"
AddColVindexStr = "on table add vindex"
DropColVindexStr = "on table drop vindex"
AddSequenceStr = "add sequence"
AddAutoIncStr = "add auto_increment"
CreateStr = "create"
AlterStr = "alter"
DeallocateStr = "deallocate"
DropStr = "drop"
RenameStr = "rename"
TruncateStr = "truncate"
FlushStr = "flush"
CreateVindexStr = "create vindex"
DropVindexStr = "drop vindex"
AddVschemaTableStr = "add vschema table"
DropVschemaTableStr = "drop vschema table"
AlterVschemaTableStr = "alter vschema table"
AddColVindexStr = "on table add vindex"
DropColVindexStr = "on table drop vindex"
AddSequenceStr = "add sequence"
AddAutoIncStr = "add auto_increment"

// ALTER TABLE ALGORITHM string.
DefaultStr = "default"
Expand Down Expand Up @@ -486,6 +487,7 @@ const (
DropVindexDDLAction
AddVschemaTableDDLAction
DropVschemaTableDDLAction
AlterVschemaTableDDLAction
AddColVindexDDLAction
DropColVindexDDLAction
AddSequenceDDLAction
Expand Down
Loading

0 comments on commit 6383f45

Please sign in to comment.