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

NewFeature:为OceanBase添加offline DDL检测 #672

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
6 changes: 6 additions & 0 deletions ast/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -2157,6 +2157,7 @@ const (
ColumnPositionNone ColumnPositionType = iota
ColumnPositionFirst
ColumnPositionAfter
ColumnPositionBefore
)

// ColumnPosition represent the position of the newly added column
Expand All @@ -2180,6 +2181,11 @@ func (n *ColumnPosition) Restore(ctx *RestoreCtx) error {
if err := n.RelativeColumn.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred while restore ColumnPosition.RelativeColumn")
}
case ColumnPositionBefore:
ctx.WriteKeyWord("BEFORE ")
if err := n.RelativeColumn.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred while restore ColumnPosition.RelativeColumn")
}
default:
return errors.Errorf("invalid ColumnPositionType: %d", n.Tp)
}
Expand Down
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ type Inc struct {
CheckTableComment bool `toml:"check_table_comment" json:"check_table_comment"`
CheckTimestampDefault bool `toml:"check_timestamp_default" json:"check_timestamp_default"`
CheckTimestampCount bool `toml:"check_timestamp_count" json:"check_timestamp_count"`
CheckOfflineDDL bool `toml:"check_offline_ddl" json:"check_offline_ddl"`
CheckToolBasedUniqueIndex bool `toml:"check_tool_based_unique_index" json:"check_tool_based_unique_index"`

EnableTimeStampType bool `toml:"enable_timestamp_type" json:"enable_timestamp_type"`
Expand Down Expand Up @@ -714,6 +715,7 @@ var defaultConf = Config{
SupportEngine: "innodb",
Lang: "en-US",
CheckColumnTypeChange: true,
CheckOfflineDDL: true,

// 连接服务器选项
DefaultCharset: "utf8mb4",
Expand Down
1 change: 1 addition & 0 deletions parser/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ var tokenMap = map[string]int{
"AUTO_RANDOM_BASE": autoRandomBase,
"AVG": avg,
"AVG_ROW_LENGTH": avgRowLength,
"BEFORE": before,
"BEGIN": begin,
"BETWEEN": between,
"BIGINT": bigIntType,
Expand Down
Loading