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

parser: add auto_random_base table option #830

Merged
merged 2 commits into from
Apr 25, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions ast/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -1413,6 +1413,7 @@ const (
TableOptionCollate
TableOptionAutoIdCache
TableOptionAutoIncrement
TableOptionAutoRandomBase
TableOptionComment
TableOptionAvgRowLength
TableOptionCheckSum
Expand Down Expand Up @@ -1497,6 +1498,10 @@ func (n *TableOption) Restore(ctx *RestoreCtx) error {
ctx.WriteKeyWord("AUTO_ID_CACHE ")
ctx.WritePlain("= ")
ctx.WritePlainf("%d", n.UintValue)
case TableOptionAutoRandomBase:
ctx.WriteKeyWord("AUTO_RANDOM_BASE ")
ctx.WritePlain("= ")
ctx.WritePlainf("%d", n.UintValue)
case TableOptionComment:
ctx.WriteKeyWord("COMMENT ")
ctx.WritePlain("= ")
Expand Down
1 change: 1 addition & 0 deletions misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ var tokenMap = map[string]int{
"AUTO_ID_CACHE": autoIdCache,
"AUTO_INCREMENT": autoIncrement,
"AUTO_RANDOM": autoRandom,
"AUTO_RANDOM_BASE": autoRandomBase,
"AVG": avg,
"AVG_ROW_LENGTH": avgRowLength,
"BEGIN": begin,
Expand Down
2 changes: 2 additions & 0 deletions model/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const (
ActionAddPrimaryKey ActionType = 32
ActionDropPrimaryKey ActionType = 33
ActionModifyTableAutoIdCache ActionType = 34
ActionRebaseAutoRandomBase ActionType = 35
)

const (
Expand Down Expand Up @@ -107,6 +108,7 @@ var actionMap = map[ActionType]string{
ActionSetTiFlashReplica: "set tiflash replica",
ActionUpdateTiFlashReplicaStatus: "update tiflash replica status",
ActionModifyTableAutoIdCache: "modify auto id cache",
ActionRebaseAutoRandomBase: "rebase auto_random ID",
}

// String return current ddl action in string
Expand Down
1 change: 1 addition & 0 deletions model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ type TableInfo struct {
Comment string `json:"comment"`
AutoIncID int64 `json:"auto_inc_id"`
AutoIdCache int64 `json:"auto_id_cache"`
AutoRandID int64 `json:"auto_rand_id"`
MaxColumnID int64 `json:"max_col_id"`
MaxIndexID int64 `json:"max_idx_id"`
// UpdateTS is used to record the timestamp of updating the table's schema information.
Expand Down
Loading