Skip to content

Commit 994651e

Browse files
authored
parser: add auto_random_base table option (#830)
1 parent 867e000 commit 994651e

7 files changed

Lines changed: 6571 additions & 6537 deletions

File tree

ast/ddl.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,6 +1413,7 @@ const (
14131413
TableOptionCollate
14141414
TableOptionAutoIdCache
14151415
TableOptionAutoIncrement
1416+
TableOptionAutoRandomBase
14161417
TableOptionComment
14171418
TableOptionAvgRowLength
14181419
TableOptionCheckSum
@@ -1497,6 +1498,10 @@ func (n *TableOption) Restore(ctx *RestoreCtx) error {
14971498
ctx.WriteKeyWord("AUTO_ID_CACHE ")
14981499
ctx.WritePlain("= ")
14991500
ctx.WritePlainf("%d", n.UintValue)
1501+
case TableOptionAutoRandomBase:
1502+
ctx.WriteKeyWord("AUTO_RANDOM_BASE ")
1503+
ctx.WritePlain("= ")
1504+
ctx.WritePlainf("%d", n.UintValue)
15001505
case TableOptionComment:
15011506
ctx.WriteKeyWord("COMMENT ")
15021507
ctx.WritePlain("= ")

misc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ var tokenMap = map[string]int{
153153
"AUTO_ID_CACHE": autoIdCache,
154154
"AUTO_INCREMENT": autoIncrement,
155155
"AUTO_RANDOM": autoRandom,
156+
"AUTO_RANDOM_BASE": autoRandomBase,
156157
"AVG": avg,
157158
"AVG_ROW_LENGTH": avgRowLength,
158159
"BEGIN": begin,

model/ddl.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ const (
6464
ActionAddPrimaryKey ActionType = 32
6565
ActionDropPrimaryKey ActionType = 33
6666
ActionModifyTableAutoIdCache ActionType = 34
67+
ActionRebaseAutoRandomBase ActionType = 35
6768
)
6869

6970
const (
@@ -107,6 +108,7 @@ var actionMap = map[ActionType]string{
107108
ActionSetTiFlashReplica: "set tiflash replica",
108109
ActionUpdateTiFlashReplicaStatus: "update tiflash replica status",
109110
ActionModifyTableAutoIdCache: "modify auto id cache",
111+
ActionRebaseAutoRandomBase: "rebase auto_random ID",
110112
}
111113

112114
// String return current ddl action in string

model/model.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ type TableInfo struct {
217217
Comment string `json:"comment"`
218218
AutoIncID int64 `json:"auto_inc_id"`
219219
AutoIdCache int64 `json:"auto_id_cache"`
220+
AutoRandID int64 `json:"auto_rand_id"`
220221
MaxColumnID int64 `json:"max_col_id"`
221222
MaxIndexID int64 `json:"max_idx_id"`
222223
// UpdateTS is used to record the timestamp of updating the table's schema information.

0 commit comments

Comments
 (0)