Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: migrate index_type_no_blob (#9236)
zll60071ce64365207
diff --git a/backend/plugin/advisor/mysqlwip/advisor_index_pk_type.go b/backend/plugin/advisor/mysqlwip/advisor_index_pk_type.goindex 318ae98a7e..601462b100 100644--- a/backend/plugin/advisor/mysqlwip/advisor_index_pk_type.go+++ b/backend/plugin/advisor/mysqlwip/advisor_index_pk_type.go@@ -77,13 +77,6 @@ type indexPkTypeChecker struct {tablesNewColumns tableColumnTypes}-type pkData struct {- table string- column string- columnType string- line int-}-func (checker *indexPkTypeChecker) EnterCreateTable(ctx *mysql.CreateTableContext) {if ctx.TableName() == nil {returndiff --git a/backend/plugin/advisor/mysqlwip/advisor_index_type_no_blob.go b/backend/plugin/advisor/mysqlwip/advisor_index_type_no_blob.goindex 6716bdc93d..6e04a41add 100644--- a/backend/plugin/advisor/mysqlwip/advisor_index_type_no_blob.go+++ b/backend/plugin/advisor/mysqlwip/advisor_index_type_no_blob.go@@ -6,29 +6,35 @@ import ("fmt""strings"- "github.com/pingcap/tidb/parser/ast"- "github.com/pingcap/tidb/parser/mysql"- "github.com/pingcap/tidb/parser/types"+ "github.com/antlr4-go/antlr/v4""github.com/pkg/errors"+ mysql "github.com/bytebase/mysql-parser"+"github.com/bytebase/bytebase/backend/plugin/advisor""github.com/bytebase/bytebase/backend/plugin/advisor/catalog"+ mysqlparser "github.com/bytebase/bytebase/backend/plugin/parser/mysql"+ storepb "github.com/bytebase/bytebase/proto/generated-go/store")var (_ advisor.Advisor = (*IndexTypeNoBlobAdvisor)(nil)- _ ast.Visitor = (*indexTypeNoBlobChecker)(nil))+func init() {+ // only for mysqlwip test.+ advisor.Register(storepb.Engine_ENGINE_UNSPECIFIED, advisor.MySQLIndexTypeNoBlob, &IndexTypeNoBlobAdvisor{})+}+// IndexTypeNoBlobAdvisor is the advisor checking for index type no blob.type IndexTypeNoBlobAdvisor struct {}// Check checks for index type no blob.func (*IndexTypeNoBlobAdvisor) Check(ctx advisor.Context, _ string) ([]advisor.Advice, error) {- stmtList, ok := ctx.AST.([]ast.StmtNode)+ stmtList, ok := ctx.AST.([]*mysqlparser.ParseResult)if !ok {- return nil, errors.Errorf("failed to convert to StmtNode")+ return nil, errors.Errorf("failed to convert to mysql parse result")}level, err := advisor.NewStatusBySQLReviewRuleLevel(ctx.Rule.Level)@@ -39,13 +45,12 @@ func (*IndexTypeNoBlobAdvisor) Check(ctx advisor.Context, _ string) ([]advisor.Alevel: level,title: string(ctx.Rule.Type),catalog: ctx.Catalog,- tablesNewColumns: make(map[string]columnNameToColumnDef),+ tablesNewColumns: make(tableColumnTypes),}for _, stmt := range stmtList {- checker.text = stmt.Text()- checker.line = stmt.OriginTextPosition()- (stmt).Accept(checker)+ checker.baseLine = stmt.BaseLine+ antlr.ParseTreeWalkerDefault.Walk(checker, stmt.Tree)}if len(checker.adviceList) == 0 {@@ -60,161 +65,187 @@ func (*IndexTypeNoBlobAdvisor) Check(ctx advisor.Context, _ string) ([]advisor.A}type indexTypeNoBlobChecker struct {+ *mysql.BaseMySQLParserListener++ baseLine intadviceList []advisor.Advicelevel advisor.Statustitle string- text string- line intcatalog *catalog.Finder- tablesNewColumns tableNewColumn+ tablesNewColumns tableColumnTypes}-// Enter implements the ast.Visitor interface.-func (v *indexTypeNoBlobChecker) Enter(in ast.Node) (ast.Node, bool) {- var pkDataList []pkData- switch node := in.(type) {- case *ast.CreateTableStmt:- tableName := node.Table.Name.String()- for _, column := range node.Cols {- pds := v.addNewColumn(tableName, column.OriginTextPosition(), column)- pkDataList = append(pkDataList, pds...)- }- for _, constraint := range node.Constraints {- pds := v.addConstraint(tableName, constraint.OriginTextPosition(), constraint)- pkDataList = append(pkDataList, pds...)+func (checker *indexTypeNoBlobChecker) EnterCreateTable(ctx *mysql.CreateTableContext) {+ if ctx.TableName() == nil {+ return+ }+ if ctx.TableElementList() == nil {+ return+ }++ _, tableName := mysqlparser.NormalizeMySQLTableName(ctx.TableName())+ for _, tableElement := range ctx.TableElementList().AllTableElement() {+ if tableElement == nil {+ continue}- case *ast.AlterTableStmt:- tableName := node.Table.Name.String()- for _, spec := range node.Specs {- switch spec.Tp {- case ast.AlterTableAddColumns:- for _, column := range spec.NewColumns {- pds := v.addNewColumn(tableName, node.OriginTextPosition(), column)- pkDataList = append(pkDataList, pds...)- }- case ast.AlterTableAddConstraint:- pds := v.addConstraint(tableName, node.OriginTextPosition(), spec.Constraint)- pkDataList = append(pkDataList, pds...)- case ast.AlterTableChangeColumn, ast.AlterTableModifyColumn:- newColumnDef := spec.NewColumns[0]- oldColumnName := newColumnDef.Name.Name.String()- if spec.OldColumnName != nil {- oldColumnName = spec.OldColumnName.Name.String()- }- pds := v.changeColumn(tableName, oldColumnName, node.OriginTextPosition(), newColumnDef)- pkDataList = append(pkDataList, pds...)+ switch {+ case tableElement.ColumnDefinition() != nil:+ if tableElement.ColumnDefinition().FieldDefinition() == nil {+ continue}- }- case *ast.CreateIndexStmt:- tableName := node.Table.Name.String()- for _, indexSpec := range node.IndexPartSpecifications {- pds := v.addIndex(tableName, node.OriginTextPosition(), indexSpec)- pkDataList = append(pkDataList, pds...)+ _, _, columnName := mysqlparser.NormalizeMySQLColumnName(tableElement.ColumnDefinition().ColumnName())+ checker.checkFieldDefinition(tableName, columnName, tableElement.ColumnDefinition().FieldDefinition())+ case tableElement.TableConstraintDef() != nil:+ checker.checkConstraintDef(tableName, tableElement.TableConstraintDef())}}- for _, pd := range pkDataList {- v.adviceList = append(v.adviceList, advisor.Advice{- Status: v.level,- Code: advisor.IndexTypeNoBlob,- Title: v.title,- Content: fmt.Sprintf("Columns in index must not be BLOB but `%s`.`%s` is %s", pd.table, pd.column, pd.columnType),- Line: pd.line,- })- }- return in, false}-// Leave implements the ast.Visitor interface.-func (*indexTypeNoBlobChecker) Leave(in ast.Node) (ast.Node, bool) {- return in, true-}+func (checker *indexTypeNoBlobChecker) EnterAlterTable(ctx *mysql.AlterTableContext) {+ if ctx.AlterTableActions() == nil {+ return+ }+ if ctx.AlterTableActions().AlterCommandList() == nil {+ return+ }+ if ctx.AlterTableActions().AlterCommandList().AlterList() == nil {+ return+ }+ if ctx.TableRef() == nil {+ return+ }++ _, tableName := mysqlparser.NormalizeMySQLTableRef(ctx.TableRef())+ for _, alterListItem := range ctx.AlterTableActions().AlterCommandList().AlterList().AllAlterListItem() {+ if alterListItem == nil {+ continue+ }-func (v *indexTypeNoBlobChecker) addNewColumn(tableName string, line int, colDef *ast.ColumnDef) []pkData {- var pkDataList []pkData- for _, option := range colDef.Options {- if option.Tp == ast.ColumnOptionUniqKey {- tp := v.getBlobStr(colDef.Tp)- if v.isBlob(tp) {- pkDataList = append(pkDataList, pkData{- table: tableName,- column: colDef.Name.String(),- columnType: tp,- line: line,- })+ switch {+ // add column+ case alterListItem.ADD_SYMBOL() != nil && alterListItem.Identifier() != nil:+ switch {+ case alterListItem.Identifier() != nil && alterListItem.FieldDefinition() != nil:+ columnName := mysqlparser.NormalizeMySQLIdentifier(alterListItem.Identifier())+ checker.checkFieldDefinition(tableName, columnName, alterListItem.FieldDefinition())+ case alterListItem.OPEN_PAR_SYMBOL() != nil && alterListItem.TableElementList() != nil:+ for _, tableElement := range alterListItem.TableElementList().AllTableElement() {+ if tableElement.ColumnDefinition() == nil || tableElement.ColumnDefinition().ColumnName() == nil || tableElement.ColumnDefinition().FieldDefinition() == nil {+ continue+ }+ _, _, columnName := mysqlparser.NormalizeMySQLColumnName(tableElement.ColumnDefinition().ColumnName())+ checker.checkFieldDefinition(tableName, columnName, tableElement.ColumnDefinition().FieldDefinition())+ }}+ // modify column+ case alterListItem.MODIFY_SYMBOL() != nil && alterListItem.ColumnInternalRef() != nil:+ columnName := mysqlparser.NormalizeMySQLColumnInternalRef(alterListItem.ColumnInternalRef())+ checker.checkFieldDefinition(tableName, columnName, alterListItem.FieldDefinition())+ // change column+ case alterListItem.CHANGE_SYMBOL() != nil && alterListItem.ColumnInternalRef() != nil && alterListItem.Identifier() != nil:+ oldColumnName := mysqlparser.NormalizeMySQLColumnInternalRef(alterListItem.ColumnInternalRef())+ checker.tablesNewColumns.delete(tableName, oldColumnName)+ newColumnName := mysqlparser.NormalizeMySQLIdentifier(alterListItem.Identifier())+ checker.checkFieldDefinition(tableName, newColumnName, alterListItem.FieldDefinition())+ // add constriant.+ case alterListItem.ADD_SYMBOL() != nil && alterListItem.TableConstraintDef() != nil:+ checker.checkConstraintDef(tableName, alterListItem.TableConstraintDef())}}- v.tablesNewColumns.set(tableName, colDef.Name.String(), colDef)- return pkDataList}-func (v *indexTypeNoBlobChecker) addIndex(tableName string, line int, indexSpec *ast.IndexPartSpecification) []pkData {- var pkDataList []pkData- columnName := indexSpec.Column.Name.String()- columnType, err := v.getColumnType(tableName, columnName)- if err != nil {- return nil- }- if v.isBlob(columnType) {- pkDataList = append(pkDataList, pkData{- table: tableName,- column: columnName,- columnType: columnType,- line: line,- })+func (checker *indexTypeNoBlobChecker) EnterCreateIndex(ctx *mysql.CreateIndexContext) {+ switch ctx.GetType_().GetTokenType() {+ case mysql.MySQLParserFULLTEXT_SYMBOL, mysql.MySQLParserSPATIAL_SYMBOL, mysql.MySQLParserFOREIGN_SYMBOL:+ return+ }+ if ctx.CreateIndexTarget() == nil || ctx.CreateIndexTarget().TableRef() == nil || ctx.CreateIndexTarget().KeyListVariants() == nil {+ return+ }++ _, tableName := mysqlparser.NormalizeMySQLTableRef(ctx.CreateIndexTarget().TableRef())+ columnList := mysqlparser.NormalizeKeyListVariants(ctx.CreateIndexTarget().KeyListVariants())+ for _, columnName := range columnList {+ columnType, err := checker.getColumnType(tableName, columnName)+ if err != nil {+ continue+ }+ columnType = strings.ToLower(columnType)+ checker.addAdvice(tableName, columnName, columnType, ctx.GetStart().GetLine())}- return pkDataList}-func (v *indexTypeNoBlobChecker) changeColumn(tableName, oldColumnName string, line int, newColumnDef *ast.ColumnDef) []pkData {- var pkDataList []pkData- v.tablesNewColumns.delete(tableName, oldColumnName)- for _, option := range newColumnDef.Options {- if option.Tp == ast.ColumnOptionPrimaryKey || option.Tp == ast.ColumnOptionUniqKey {- tp := v.getBlobStr(newColumnDef.Tp)- if v.isBlob(tp) {- pkDataList = append(pkDataList, pkData{- table: tableName,- column: newColumnDef.Name.String(),- columnType: tp,- line: line,- })- }+func (checker *indexTypeNoBlobChecker) checkFieldDefinition(tableName, columnName string, ctx mysql.IFieldDefinitionContext) {+ if ctx.DataType() == nil {+ return+ }+ columnType := mysqlparser.NormalizeMySQLDataType(ctx.DataType(), true /* compact */)+ for _, attribute := range ctx.AllColumnAttribute() {+ // the FieldDefinitionContext can only set primary or unique.+ switch attribute.GetValue().GetTokenType() {+ case mysql.MySQLParserPRIMARY_SYMBOL, mysql.MySQLParserUNIQUE_SYMBOL:+ // do nothing+ default:+ continue}+ checker.addAdvice(tableName, columnName, columnType, ctx.GetStart().GetLine())}- v.tablesNewColumns.set(tableName, newColumnDef.Name.String(), newColumnDef)- return pkDataList+ checker.tablesNewColumns.set(tableName, columnName, columnType)}-func (v *indexTypeNoBlobChecker) addConstraint(tableName string, line int, constraint *ast.Constraint) []pkData {- var pkDataList []pkData- if constraint.Tp == ast.ConstraintPrimaryKey || constraint.Tp == ast.ConstraintUniqKey || constraint.Tp == ast.ConstraintKey ||- constraint.Tp == ast.ConstraintIndex || constraint.Tp == ast.ConstraintUniqIndex || constraint.Tp == ast.ConstraintUniq {- for _, key := range constraint.Keys {- columnName := key.Column.Name.String()- columnType, err := v.getColumnType(tableName, columnName)- if err != nil {- continue- }- if v.isBlob(columnType) {- pkDataList = append(pkDataList, pkData{- table: tableName,- column: columnName,- columnType: columnType,- line: line,- })- }+func (checker *indexTypeNoBlobChecker) checkConstraintDef(tableName string, ctx mysql.ITableConstraintDefContext) {+ var columnList []string+ switch ctx.GetType_().GetTokenType() {+ case mysql.MySQLParserINDEX_SYMBOL, mysql.MySQLParserKEY_SYMBOL, mysql.MySQLParserPRIMARY_SYMBOL, mysql.MySQLParserUNIQUE_SYMBOL:+ if ctx.KeyListVariants() == nil {+ return+ }+ columnList = mysqlparser.NormalizeKeyListVariants(ctx.KeyListVariants())+ case mysql.MySQLParserFOREIGN_SYMBOL:+ if ctx.KeyList() == nil {+ return+ }+ columnList = mysqlparser.NormalizeKeyList(ctx.KeyList())+ default:+ return+ }++ for _, columnName := range columnList {+ columnType, err := checker.getColumnType(tableName, columnName)+ if err != nil {+ continue}+ columnType = strings.ToLower(columnType)+ checker.addAdvice(tableName, columnName, columnType, ctx.GetStart().GetLine())}- return pkDataList}-// getPKColumnType gets the column type string from v.tablesNewColumns or catalog, returns empty string and non-nil error if cannot find the column in given table.-func (v *indexTypeNoBlobChecker) getColumnType(tableName string, columnName string) (string, error) {- if colDef, ok := v.tablesNewColumns.get(tableName, columnName); ok {- return v.getBlobStr(colDef.Tp), nil+func (checker *indexTypeNoBlobChecker) addAdvice(tableName, columnName, columnType string, lineNumber int) {+ if checker.isBlob(columnType) {+ checker.adviceList = append(checker.adviceList, advisor.Advice{+ Status: checker.level,+ Code: advisor.IndexTypeNoBlob,+ Title: checker.title,+ Content: fmt.Sprintf("Columns in index must not be BLOB but `%s`.`%s` is %s", tableName, columnName, columnType),+ Line: checker.baseLine + lineNumber,+ })+ }+}+func (*indexTypeNoBlobChecker) isBlob(columnType string) bool {+ switch strings.ToLower(columnType) {+ case "blob", "tinyblob", "mediumblob", "longblob":+ return true+ default:+ return false+ }+}++// getColumnType gets the column type string from checker.tableColumnTypes or catalog, returns empty string and non-nil error if cannot find the column in given table.+func (checker *indexTypeNoBlobChecker) getColumnType(tableName string, columnName string) (string, error) {+ if columnType, ok := checker.tablesNewColumns.get(tableName, columnName); ok {+ return columnType, nil}- column := v.catalog.Origin.FindColumn(&catalog.ColumnFind{+ column := checker.catalog.Origin.FindColumn(&catalog.ColumnFind{TableName: tableName,ColumnName: columnName,})@@ -223,23 +254,3 @@ func (v *indexTypeNoBlobChecker) getColumnType(tableName string, columnName stri}return "", errors.Errorf("cannot find the type of `%s`.`%s`", tableName, columnName)}--// getIntOrBigIntStr returns the type string of tp.-func (*indexTypeNoBlobChecker) getBlobStr(tp *types.FieldType) string {- switch tp.GetType() {- case mysql.TypeTinyBlob:- return "tinyblob"- case mysql.TypeBlob:- return "blob"- case mysql.TypeMediumBlob:- return "mediumblob"- case mysql.TypeLongBlob:- return "longblob"- }- return tp.String()-}--func (*indexTypeNoBlobChecker) isBlob(tp string) bool {- up := strings.ToUpper(tp)- return up == "TINYBLOB" || up == "BLOB" || up == "MEDIUMBLOB" || up == "LONGBLOB"-}diff --git a/backend/plugin/advisor/mysqlwip/mysqlwip_rules_test.go b/backend/plugin/advisor/mysqlwip/mysqlwip_rules_test.goindex 5c026e4db4..b4d35fc8cc 100644--- a/backend/plugin/advisor/mysqlwip/mysqlwip_rules_test.go+++ b/backend/plugin/advisor/mysqlwip/mysqlwip_rules_test.go@@ -87,6 +87,8 @@ func TestMySQLWIPRules(t *testing.T) {advisor.SchemaRuleIndexKeyNumberLimit,// advisor.SchemaRuleIndexPKTypeLimit enforce the type restriction of columns in primary key.advisor.SchemaRuleIndexPKTypeLimit,+ // advisor.SchemaRuleIndexTypeNoBlob enforce the type restriction of columns in index.+ advisor.SchemaRuleIndexTypeNoBlob,// advisor.SchemaRuleIndexTotalNumberLimit enforce the index total number limit.advisor.SchemaRuleIndexTotalNumberLimit,advisor.SchemaRuleIndexPrimaryKeyTypeAllowlist,diff --git a/backend/plugin/advisor/mysqlwip/test/index_type_no_blob.yaml b/backend/plugin/advisor/mysqlwip/test/index_type_no_blob.yamlindex ef671ba1ea..59a380d416 100644--- a/backend/plugin/advisor/mysqlwip/test/index_type_no_blob.yaml+++ b/backend/plugin/advisor/mysqlwip/test/index_type_no_blob.yaml@@ -1,4 +1,4 @@-- statement: CREATE TABLE t(b BLOB, PRIMARY KEY(b(10)))+- statement: CREATE TABLE t(b BLOB, PRIMARY KEY(b(10)));want:- status: WARNcode: 804@@ -6,7 +6,7 @@content: Columns in index must not be BLOB but `t`.`b` is blobline: 1details: ""-- statement: CREATE TABLE t(b BLOB, mb MEDIUMBLOB, lb LONGBLOB, id INT, PRIMARY KEY(b(1), mb(2), lb(3), id))+- statement: CREATE TABLE t(b BLOB, mb MEDIUMBLOB, lb LONGBLOB, id INT, PRIMARY KEY(b(1), mb(2), lb(3), id));want:- status: WARNcode: 804@@ -76,13 +76,13 @@details: ""- statement: |-CREATE TABLE t(a int);- ALTER TABLE t ADD COLUMN b BLOB, ADD COLUMN id INT, ADD PRIMARY KEY(b(1), id)+ ALTER TABLE t ADD COLUMN b BLOB, ADD COLUMN id INT, ADD PRIMARY KEY(b(1), id);want:- status: WARNcode: 804title: index.type-no-blobcontent: Columns in index must not be BLOB but `t`.`b` is blob- line: 3+ line: 2details: ""- statement: |-CREATE TABLE t(a int);@@ -92,19 +92,19 @@code: 804title: index.type-no-blobcontent: Columns in index must not be BLOB but `t`.`b` is blob- line: 3+ line: 2details: ""- status: WARNcode: 804title: index.type-no-blobcontent: Columns in index must not be BLOB but `t`.`lb` is longblob- line: 3+ line: 2details: ""- status: WARNcode: 804title: index.type-no-blobcontent: Columns in index must not be BLOB but `t`.`mb` is mediumblob- line: 3+ line: 2details: ""- statement: |-CREATE TABLE t(a int);@@ -114,23 +114,23 @@code: 804title: index.type-no-blobcontent: Columns in index must not be BLOB but `t`.`b` is blob- line: 3+ line: 2details: ""- status: WARNcode: 804title: index.type-no-blobcontent: Columns in index must not be BLOB but `t`.`lb` is longblob- line: 3+ line: 2details: ""- status: WARNcode: 804title: index.type-no-blobcontent: Columns in index must not be BLOB but `t`.`mb` is mediumblob- line: 3+ line: 2details: ""- statement: |-CREATE TABLE t(a int);- ALTER TABLE t ADD COLUMN b BLOB, ADD COLUMN mb MEDIUMBLOB, ADD COLUMN lb LONGBLOB, ADD COLUMN id INT, ADD INDEX(id)+ ALTER TABLE t ADD COLUMN b BLOB, ADD COLUMN mb MEDIUMBLOB, ADD COLUMN lb LONGBLOB, ADD COLUMN id INT, ADD INDEX(id);want:- status: SUCCESScode: 0@@ -140,10 +140,10 @@details: ""- statement: |-CREATE TABLE t(b blob, mb mediumblob, lb longblob, id int);- CREATE INDEX idx_b ON t(b(5));- CREATE INDEX idx_mb ON t(mb(5));- CREATE INDEX idx_lb ON t(lb(5));- CREATE INDEX idx_id ON t(id);+ CREATE INDEX idx_b ON t(b(5));+ CREATE INDEX idx_mb ON t(mb(5));+ CREATE INDEX idx_lb ON t(lb(5));+ CREATE INDEX idx_id ON t(id);want:- status: WARNcode: 804@@ -165,7 +165,7 @@details: ""- statement: |-CREATE TABLE t(b blob, mb mediumblob, lb longblob, id int);- CREATE INDEX idx_id ON t(id);+ CREATE INDEX idx_id ON t(id);want:- status: SUCCESScode: 0@@ -173,3 +173,25 @@content: ""line: 0details: ""+- statement: |-+ CREATE TABLE t(b int, mb mediumblob, lb longblob, id int);+ ALTER TABLE t MODIFY COLUMN b blob;+ ALTER TABLE t ADD PRIMARY KEY(b);+ want:+ - status: WARN+ code: 804+ title: index.type-no-blob+ content: Columns in index must not be BLOB but `t`.`b` is blob+ line: 3+ details: ""+- statement: |-+ CREATE TABLE t(b int, mb mediumblob, lb longblob, id int);+ ALTER TABLE t CHANGE COLUMN b d blob;+ ALTER TABLE t ADD PRIMARY KEY(d);+ want:+ - status: WARN+ code: 804+ title: index.type-no-blob+ content: Columns in index must not be BLOB but `t`.`d` is blob+ line: 3+ details: ""diff --git a/backend/plugin/advisor/mysqlwip/utils.go b/backend/plugin/advisor/mysqlwip/utils.goindex 428fb37120..71180be07a 100644--- a/backend/plugin/advisor/mysqlwip/utils.go+++ b/backend/plugin/advisor/mysqlwip/utils.go@@ -117,28 +117,3 @@ func (t tableColumnTypes) delete(tableName string, columnName string) {}delete(t[tableName], columnName)}--type columnNameToColumnDef map[string]*ast.ColumnDef-type tableNewColumn map[string]columnNameToColumnDef--func (t tableNewColumn) set(tableName string, columnName string, colDef *ast.ColumnDef) {- if _, ok := t[tableName]; !ok {- t[tableName] = make(map[string]*ast.ColumnDef)- }- t[tableName][columnName] = colDef-}--func (t tableNewColumn) get(tableName string, columnName string) (colDef *ast.ColumnDef, ok bool) {- if _, ok := t[tableName]; !ok {- return nil, false- }- col, ok := t[tableName][columnName]- return col, ok-}--func (t tableNewColumn) delete(tableName string, columnName string) {- if _, ok := t[tableName]; !ok {- return- }- delete(t[tableName], columnName)-}diff --git a/backend/plugin/advisor/sql_review.go b/backend/plugin/advisor/sql_review.goindex 1adc1e0558..2a8a35ae2b 100644--- a/backend/plugin/advisor/sql_review.go+++ b/backend/plugin/advisor/sql_review.go@@ -1459,6 +1459,9 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty}case SchemaRuleIndexTypeNoBlob:switch engine {+ // only for mysqlwip test.+ case storepb.Engine_ENGINE_UNSPECIFIED:+ return MySQLIndexTypeNoBlob, nilcase storepb.Engine_MYSQL, storepb.Engine_TIDB, storepb.Engine_MARIADB, storepb.Engine_OCEANBASE:return MySQLIndexTypeNoBlob, nil}