Skip to content

Commit

Permalink
parser, ast: add ColumnOptionCollate for all column types
Browse files Browse the repository at this point in the history
  • Loading branch information
bb7133 committed Mar 25, 2019
1 parent cc0fa08 commit 9cfdcc3
Show file tree
Hide file tree
Showing 4 changed files with 4,371 additions and 4,325 deletions.
6 changes: 5 additions & 1 deletion ast/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ const (
ColumnOptionComment
ColumnOptionGenerated
ColumnOptionReference
ColumnOptionCollate
)

// ColumnOption is used for parsing column constraint info from SQL.
Expand All @@ -365,7 +366,8 @@ type ColumnOption struct {
// Stored is only for ColumnOptionGenerated, default is false.
Stored bool
// Refer is used for foreign key.
Refer *ReferenceDef
Refer *ReferenceDef
StrValue string
}

// Restore implements Node interface.
Expand Down Expand Up @@ -416,6 +418,8 @@ func (n *ColumnOption) Restore(ctx *RestoreCtx) error {
if err := n.Refer.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred while splicing ColumnOption ReferenceDef")
}
case ColumnOptionCollate:
// Do nothing, we should never see a ColumnOptionCollate after parsing
default:
return errors.New("An error occurred while splicing ColumnOption")
}
Expand Down
Loading

0 comments on commit 9cfdcc3

Please sign in to comment.