Skip to content

Commit 9cbe740

Browse files
committed
support drop column and rename column
1 parent eef9c5f commit 9cbe740

File tree

5 files changed

+1088
-892
lines changed

5 files changed

+1088
-892
lines changed

ast/ddl.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,12 @@ type ColumnDefine struct {
3333

3434
type ModifyColumnClause struct {
3535
columnClause
36+
}
37+
38+
type DropColumnClause struct {
39+
columnClause
40+
}
41+
42+
type RenameColumnClause struct {
43+
columnClause
3644
}

lexer.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,14 @@ var keywordMap = map[string]int{
182182
"levels": _levels,
183183
"substitutable": _substitutable,
184184
"force": _force,
185+
"columns": _columns,
186+
"continue": _continue,
187+
"unused": _unused,
188+
"constraints": _constraints,
189+
"invalidate": _invalidate,
190+
"online": _online,
191+
"checkpoint": _checkpoint,
192+
"rename": _rename,
185193
}
186194

187195
func init() {

parser_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ alter table db1.table1 add (id number default 123)
5858
`,
5959
`
6060
alter table db1.table1 modify (id number default 123)
61+
`,
62+
`
63+
alter table db1.table1 drop column id
64+
`,
65+
`
66+
alter table db1.table1 drop (id,name)
67+
`,
68+
`
69+
alter table db1.table1 set unused column id
6170
`,
6271
}
6372
for _, query := range querys {

0 commit comments

Comments
 (0)