diff --git a/sqle/driver/mysql/audit_test.go b/sqle/driver/mysql/audit_test.go index 8d13176e0..84cdf8225 100644 --- a/sqle/driver/mysql/audit_test.go +++ b/sqle/driver/mysql/audit_test.go @@ -2246,6 +2246,13 @@ ALTER TABLE exist_db.exist_tb_1 CHANGE COLUMN v2 v3 varchar(255) NOT NULL DEFAUL `, newTestResult().addResult(rulepkg.DDLCheckColumnWithoutComment), ) + + runSingleRuleInspectCase(rule, t, "alter_table: column without comment(1)", DefaultMysqlInspect(), +` +ALTER TABLE exist_db.exist_tb_1 MODIFY COLUMN v3 varchar(500) NOT NULL DEFAULT "modified unit test"; +`, +newTestResult().addResult(rulepkg.DDLCheckColumnWithoutComment), +) } func TestCheckIndexPrefix(t *testing.T) { diff --git a/sqle/driver/mysql/rule/rule.go b/sqle/driver/mysql/rule/rule.go index 26f41bf4e..51f6751c7 100644 --- a/sqle/driver/mysql/rule/rule.go +++ b/sqle/driver/mysql/rule/rule.go @@ -2227,7 +2227,7 @@ func checkColumnWithoutComment(input *RuleHandlerInput) error { if stmt.Specs == nil { return nil } - for _, spec := range util.GetAlterTableSpecByTp(stmt.Specs, ast.AlterTableAddColumns, ast.AlterTableChangeColumn) { + for _, spec := range util.GetAlterTableSpecByTp(stmt.Specs, ast.AlterTableAddColumns, ast.AlterTableChangeColumn, ast.AlterTableModifyColumn) { for _, col := range spec.NewColumns { columnHasComment := false for _, op := range col.Options {