Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: cancel naming exists check (#8996)

zll6007819597b1111
diff --git a/backend/plugin/advisor/code.go b/backend/plugin/advisor/code.go
index 36ab2c5fda..ad4d2b992b 100644
--- a/backend/plugin/advisor/code.go
+++ b/backend/plugin/advisor/code.go
@@ -57,8 +57,6 @@ const (
NameIsKeywordIdentifier Code = 308
// 309 naming case mismatch advisor error code.
NamingCaseMismatch Code = 309
- // 310 unique key name is empty advisor error code.
- NamingUKNameEmpty Code = 310
// 401 ~ 499 column error code.
NoRequiredColumn Code = 401
diff --git a/backend/plugin/advisor/mysqlwip/advisor_naming_unique_key_convention.go b/backend/plugin/advisor/mysqlwip/advisor_naming_unique_key_convention.go
index 2643c094ed..88cdc74ff3 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_naming_unique_key_convention.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_naming_unique_key_convention.go
@@ -206,17 +206,6 @@ func (checker *namingUKConventionChecker) EnterCreateIndex(ctx *mysql.CreateInde
func (checker *namingUKConventionChecker) handleIndexList(indexDataList []*indexMetaData) {
for _, indexData := range indexDataList {
- // if indexName is not set explicitly. we throw an error.
- if indexData.indexName == "" {
- checker.adviceList = append(checker.adviceList, advisor.Advice{
- Status: checker.level,
- Title: checker.title,
- Code: advisor.NamingUKNameEmpty,
- Content: fmt.Sprintf("Unique key in table `%s` should be set a name explicitly", indexData.tableName),
- Line: indexData.line,
- })
- continue
- }
regex, err := getTemplateRegexp(checker.format, checker.templateList, indexData.metaData)
if err != nil {
checker.adviceList = append(checker.adviceList, advisor.Advice{
diff --git a/backend/plugin/advisor/mysqlwip/test/naming_index_uk.yaml b/backend/plugin/advisor/mysqlwip/test/naming_index_uk.yaml
index 8260b074bd..e5748a7375 100644
--- a/backend/plugin/advisor/mysqlwip/test/naming_index_uk.yaml
+++ b/backend/plugin/advisor/mysqlwip/test/naming_index_uk.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ column: 0
details: ""
- statement: |
CREATE UNIQUE INDEX uk_tech_book_id_name ON tech_book(id, name);
@@ -15,6 +16,7 @@
title: naming.index.uk
content: Unique key in table `tech_book` mismatches the naming convention, expect "^$|^uk_tech_book_id_name$" but found `tech_book_id_name`
line: 2
+ column: 0
details: ""
- statement: |
CREATE UNIQUE INDEX uk_tech_book_id_name ON tech_book(id, name);
@@ -25,12 +27,14 @@
title: naming.index.uk
content: Unique key `qtzmquwvlnttctfluoouxelxeliltcfzzstrtyocogwwyiyrflmrkbhbfasynlacy` in table `tech_book` mismatches the naming convention, its length should be within 64 characters
line: 2
+ column: 0
details: ""
- status: WARN
code: 304
title: naming.index.uk
content: Unique key in table `tech_book` mismatches the naming convention, expect "^$|^uk_tech_book_id_name$" but found `qtzmquwvlnttctfluoouxelxeliltcfzzstrtyocogwwyiyrflmrkbhbfasynlacy`
line: 2
+ column: 0
details: ""
- statement: ALTER TABLE tech_book ADD UNIQUE uk_tech_book_id_name (id, name);
want:
@@ -39,6 +43,7 @@
title: OK
content: ""
line: 0
+ column: 0
details: ""
- statement: |
CREATE TABLE t1(a INT);
@@ -49,6 +54,7 @@
title: naming.index.uk
content: Unique key in table `tech_book` mismatches the naming convention, expect "^$|^uk_tech_book_id_name$" but found `tech_book_id_name`
line: 2
+ column: 0
details: ""
- statement: ALTER TABLE tech_book RENAME INDEX old_uk TO uk_tech_book_id_name;
want:
@@ -57,6 +63,7 @@
title: OK
content: ""
line: 0
+ column: 0
details: ""
- statement: |
CREATE TABLE t1(a INT);
@@ -67,6 +74,7 @@
title: naming.index.uk
content: Unique key in table `tech_book` mismatches the naming convention, expect "^$|^uk_tech_book_id_name$" but found `uk_tech_book`
line: 2
+ column: 0
details: ""
- statement: CREATE TABLE book(id INT PRIMARY KEY, name VARCHAR(20), UNIQUE INDEX uk_book_name (name));
want:
@@ -75,6 +83,7 @@
title: OK
content: ""
line: 0
+ column: 0
details: ""
- statement: |
CREATE TABLE book(
@@ -83,11 +92,12 @@
UNIQUE KEY (name)
);
want:
- - status: WARN
- code: 310
- title: naming.index.uk
- content: "Unique key in table `book` should be set a name explicitly"
- line: 4
+ - status: SUCCESS
+ code: 0
+ title: OK
+ content: ""
+ line: 0
+ column: 0
details: ""
- statement: |
CREATE TABLE book(
@@ -96,9 +106,10 @@
UNIQUE INDEX (name)
);
want:
- - status: WARN
- code: 310
- title: naming.index.uk
- content: "Unique key in table `book` should be set a name explicitly"
- line: 4
+ - status: SUCCESS
+ code: 0
+ title: OK
+ content: ""
+ line: 0
+ column: 0
details: ""