Skip to content

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

fix: skip JSON in ColumnDisallowSetCharset (#5564)

rebelicefe355886a1db
diff --git a/backend/plugin/advisor/mysql/advisor_column_disallow_set_charset.go b/backend/plugin/advisor/mysql/advisor_column_disallow_set_charset.go
index 27feb41908..be2b907f48 100644
--- a/backend/plugin/advisor/mysql/advisor_column_disallow_set_charset.go
+++ b/backend/plugin/advisor/mysql/advisor_column_disallow_set_charset.go
@@ -74,7 +74,7 @@ func (checker *columnDisallowSetCharsetChecker) Enter(in ast.Node) (ast.Node, bo
case *ast.CreateTableStmt:
for _, column := range node.Cols {
charset := getColumnCharset(column)
- if charset != "" {
+ if !checkCharset(charset) {
code = advisor.SetColumnCharset
break
}
@@ -85,13 +85,13 @@ func (checker *columnDisallowSetCharsetChecker) Enter(in ast.Node) (ast.Node, bo
case ast.AlterTableAddColumns:
for _, column := range spec.NewColumns {
charset := getColumnCharset(column)
- if charset != "" {
+ if !checkCharset(charset) {
code = advisor.SetColumnCharset
}
}
case ast.AlterTableChangeColumn, ast.AlterTableModifyColumn:
charset := getColumnCharset(spec.NewColumns[0])
- if charset != "" {
+ if !checkCharset(charset) {
code = advisor.SetColumnCharset
}
}
@@ -118,3 +118,13 @@ func (checker *columnDisallowSetCharsetChecker) Enter(in ast.Node) (ast.Node, bo
func (*columnDisallowSetCharsetChecker) Leave(in ast.Node) (ast.Node, bool) {
return in, true
}
+
+func checkCharset(charset string) bool {
+ switch charset {
+ // empty charset or binary for JSON.
+ case "", "binary":
+ return true
+ default:
+ return false
+ }
+}
diff --git a/backend/plugin/advisor/mysql/test/column_auto_increment_initial_value.yaml b/backend/plugin/advisor/mysql/test/column_auto_increment_initial_value.yaml
index d2a3a3798f..e6b9f972e2 100644
--- a/backend/plugin/advisor/mysql/test/column_auto_increment_initial_value.yaml
+++ b/backend/plugin/advisor/mysql/test/column_auto_increment_initial_value.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE t(a int auto_increment) auto_increment = 20
want:
- status: SUCCESS
@@ -12,6 +13,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE t(a int auto_increment) auto_increment = 2
want:
- status: WARN
@@ -19,3 +21,4 @@
title: column.auto-increment-initial-value
content: The initial auto-increment value in table `t` is 2, which doesn't equal 20
line: 1
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/column_auto_increment_must_integer.yaml b/backend/plugin/advisor/mysql/test/column_auto_increment_must_integer.yaml
index daaf4696ad..3685dbf6db 100644
--- a/backend/plugin/advisor/mysql/test/column_auto_increment_must_integer.yaml
+++ b/backend/plugin/advisor/mysql/test/column_auto_increment_must_integer.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE t(a varchar(255) AUTO_INCREMENT)
want:
- status: WARN
@@ -12,6 +13,7 @@
title: column.auto-increment-must-integer
content: Auto-increment column `t`.`a` requires integer type
line: 1
+ details: ""
- statement: |-
CREATE TABLE t(b int);
ALTER TABLE t ADD COLUMN a varchar(255) AUTO_INCREMENT
@@ -21,6 +23,7 @@
title: column.auto-increment-must-integer
content: Auto-increment column `t`.`a` requires integer type
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t MODIFY COLUMN a varchar(255) AUTO_INCREMENT
@@ -30,6 +33,7 @@
title: column.auto-increment-must-integer
content: Auto-increment column `t`.`a` requires integer type
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(b int);
ALTER TABLE t CHANGE COLUMN b a varchar(255) AUTO_INCREMENT
@@ -39,3 +43,4 @@
title: column.auto-increment-must-integer
content: Auto-increment column `t`.`a` requires integer type
line: 2
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/column_auto_increment_must_unsigned.yaml b/backend/plugin/advisor/mysql/test/column_auto_increment_must_unsigned.yaml
index 3a46434ced..07fa3166a1 100644
--- a/backend/plugin/advisor/mysql/test/column_auto_increment_must_unsigned.yaml
+++ b/backend/plugin/advisor/mysql/test/column_auto_increment_must_unsigned.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE t(a INT AUTO_INCREMENT)
want:
- status: WARN
@@ -12,6 +13,7 @@
title: column.auto-increment-must-unsigned
content: Auto-increment column `t`.`a` is not UNSIGNED type
line: 1
+ details: ""
- statement: |-
CREATE TABLE t(b int);
ALTER TABLE t ADD COLUMN a INT AUTO_INCREMENT
@@ -21,6 +23,7 @@
title: column.auto-increment-must-unsigned
content: Auto-increment column `t`.`a` is not UNSIGNED type
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t MODIFY COLUMN a INT AUTO_INCREMENT
@@ -30,6 +33,7 @@
title: column.auto-increment-must-unsigned
content: Auto-increment column `t`.`a` is not UNSIGNED type
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(b int);
ALTER TABLE t CHANGE COLUMN b a INT AUTO_INCREMENT
@@ -39,3 +43,4 @@
title: column.auto-increment-must-unsigned
content: Auto-increment column `t`.`a` is not UNSIGNED type
line: 2
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/column_comment.yaml b/backend/plugin/advisor/mysql/test/column_comment.yaml
index eb82551753..0bacb51ad3 100644
--- a/backend/plugin/advisor/mysql/test/column_comment.yaml
+++ b/backend/plugin/advisor/mysql/test/column_comment.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(
a int COMMENT 'some comments',
@@ -16,16 +17,19 @@
title: column.comment
content: The length of column `t`.`a` comment should be within 10 characters
line: 2
+ details: ""
- status: WARN
code: 408
title: column.comment
content: Column `t`.`b` requires comments
line: 3
+ details: ""
- status: WARN
code: 408
title: column.comment
content: Column `t`.`c` requires comments
line: 4
+ details: ""
- statement: |-
CREATE TABLE t(a int COMMENT 'comment');
ALTER TABLE t ADD COLUMN b int
@@ -35,6 +39,7 @@
title: column.comment
content: Column `t`.`b` requires comments
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(a int COMMENT 'this is comment');
ALTER TABLE t CHANGE COLUMN a b int
@@ -44,11 +49,13 @@
title: column.comment
content: The length of column `t`.`a` comment should be within 10 characters
line: 1
+ details: ""
- status: WARN
code: 408
title: column.comment
content: Column `t`.`b` requires comments
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(b int COMMENT 'It is comment');
ALTER TABLE t MODIFY COLUMN b int
@@ -58,11 +65,13 @@
title: column.comment
content: The length of column `t`.`b` comment should be within 10 characters
line: 1
+ details: ""
- status: WARN
code: 408
title: column.comment
content: Column `t`.`b` requires comments
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(b int COMMENT 'It is COMMENT');
ALTER TABLE t MODIFY COLUMN b int COMMENT 'abcdefghiakljhakljdsfalugelkhnabsdguelkadf'
@@ -72,8 +81,10 @@
title: column.comment
content: The length of column `t`.`b` comment should be within 10 characters
line: 1
+ details: ""
- status: WARN
code: 409
title: column.comment
content: The length of column `t`.`b` comment should be within 10 characters
line: 2
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/column_current_time_count_limit.yaml b/backend/plugin/advisor/mysql/test/column_current_time_count_limit.yaml
index 1d31c96f8f..08b3c5ded7 100644
--- a/backend/plugin/advisor/mysql/test/column_current_time_count_limit.yaml
+++ b/backend/plugin/advisor/mysql/test/column_current_time_count_limit.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(
a timestamp default now(),
@@ -17,6 +18,7 @@
title: column.current-time-count-limit
content: Table `t` has 3 DEFAULT CURRENT_TIMESTAMP() columns. The count greater than 2.
line: 5
+ details: ""
- statement: |-
CREATE TABLE t(
a timestamp default now() on update localtime,
@@ -28,6 +30,7 @@
title: column.current-time-count-limit
content: Table `t` has 2 ON UPDATE CURRENT_TIMESTAMP() columns. The count greater than 1.
line: 4
+ details: ""
- statement: |-
ALTER TABLE tech_book ADD COLUMN a timestamp default now() on update localtime;
ALTER TABLE tech_book ADD COLUMN b timestamp default current_timestamp() on update localtimestamp();
@@ -37,3 +40,4 @@
title: column.current-time-count-limit
content: Table `tech_book` has 2 ON UPDATE CURRENT_TIMESTAMP() columns. The count greater than 1.
line: 2
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/column_disallow_change.yaml b/backend/plugin/advisor/mysql/test/column_disallow_change.yaml
index e3f11e3953..0cac3ff8d6 100644
--- a/backend/plugin/advisor/mysql/test/column_disallow_change.yaml
+++ b/backend/plugin/advisor/mysql/test/column_disallow_change.yaml
@@ -7,6 +7,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(b int);
ALTER TABLE t CHANGE COLUMN b a int
@@ -16,3 +17,4 @@
title: column.disallow-change
content: '"ALTER TABLE t CHANGE COLUMN b a int" contains CHANGE COLUMN statement'
line: 2
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/column_disallow_change_type.yaml b/backend/plugin/advisor/mysql/test/column_disallow_change_type.yaml
index f8f8b61239..d2e7fa820d 100644
--- a/backend/plugin/advisor/mysql/test/column_disallow_change_type.yaml
+++ b/backend/plugin/advisor/mysql/test/column_disallow_change_type.yaml
@@ -5,6 +5,7 @@
title: column.disallow-change-type
content: '"ALTER TABLE tech_book MODIFY id INTEGER UNSIGNED" changes column type'
line: 1
+ details: ""
- statement: ALTER TABLE tech_book MODIFY id int
want:
- status: SUCCESS
@@ -12,6 +13,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: ALTER TABLE tech_book MODIFY id bigint
want:
- status: WARN
@@ -19,6 +21,7 @@
title: column.disallow-change-type
content: '"ALTER TABLE tech_book MODIFY id bigint" changes column type'
line: 1
+ details: ""
- statement: ALTER TABLE tech_book CHANGE name uname varchar(20)
want:
- status: WARN
@@ -26,3 +29,4 @@
title: column.disallow-change-type
content: '"ALTER TABLE tech_book CHANGE name uname varchar(20)" changes column type'
line: 1
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/column_disallow_changing_order.yaml b/backend/plugin/advisor/mysql/test/column_disallow_changing_order.yaml
index f7ec6d05f9..fe5c5f252f 100644
--- a/backend/plugin/advisor/mysql/test/column_disallow_changing_order.yaml
+++ b/backend/plugin/advisor/mysql/test/column_disallow_changing_order.yaml
@@ -7,6 +7,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t MODIFY COLUMN a int FIRST
@@ -16,6 +17,7 @@
title: column.disallow-changing-order
content: '"ALTER TABLE t MODIFY COLUMN a int FIRST" changes column order'
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(b int, a1 int);
ALTER TABLE t CHANGE COLUMN a1 a int FIRST
@@ -25,6 +27,7 @@
title: column.disallow-changing-order
content: '"ALTER TABLE t CHANGE COLUMN a1 a int FIRST" changes column order'
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(a int, b int);
ALTER TABLE t MODIFY COLUMN a int AFTER b
@@ -34,6 +37,7 @@
title: column.disallow-changing-order
content: '"ALTER TABLE t MODIFY COLUMN a int AFTER b" changes column order'
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(a1 int, b int);
ALTER TABLE t CHANGE COLUMN a1 a int AFTER b
@@ -43,3 +47,4 @@
title: column.disallow-changing-order
content: '"ALTER TABLE t CHANGE COLUMN a1 a int AFTER b" changes column order'
line: 2
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/column_disallow_set_charset.yaml b/backend/plugin/advisor/mysql/test/column_disallow_set_charset.yaml
index a09814a422..781d8e6431 100644
--- a/backend/plugin/advisor/mysql/test/column_disallow_set_charset.yaml
+++ b/backend/plugin/advisor/mysql/test/column_disallow_set_charset.yaml
@@ -1,3 +1,13 @@
+- statement: |-
+ CREATE TABLE dt_relation_temp(objto int);
+ ALTER TABLE dt_relation_temp ADD COLUMN infos json null comment'关系信息点'AFTER`objto`;
+ want:
+ - status: SUCCESS
+ code: 0
+ title: OK
+ content: ""
+ line: 0
+ details: ""
- statement: CREATE TABLE t(a varchar(20))
want:
- status: SUCCESS
@@ -5,6 +15,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE t(a varchar(20) CHARSET ascii)
want:
- status: WARN
@@ -12,6 +23,7 @@
title: column.disallow-set-charset
content: Disallow set column charset but "CREATE TABLE t(a varchar(20) CHARSET ascii)" does
line: 1
+ details: ""
- statement: ALTER TABLE tech_book ADD COLUMN a varchar(20) CHARSET ascii
want:
- status: WARN
@@ -19,6 +31,7 @@
title: column.disallow-set-charset
content: Disallow set column charset but "ALTER TABLE tech_book ADD COLUMN a varchar(20) CHARSET ascii" does
line: 1
+ details: ""
- statement: ALTER TABLE tech_book MODIFY COLUMN id varchar(20) CHARSET ascii
want:
- status: WARN
@@ -26,6 +39,7 @@
title: column.disallow-set-charset
content: Disallow set column charset but "ALTER TABLE tech_book MODIFY COLUMN id varchar(20) CHARSET ascii" does
line: 1
+ details: ""
- statement: ALTER TABLE tech_book CHANGE COLUMN name name varchar(20) CHARSET ascii
want:
- status: WARN
@@ -33,3 +47,4 @@
title: column.disallow-set-charset
content: Disallow set column charset but "ALTER TABLE tech_book CHANGE COLUMN name name varchar(20) CHARSET ascii" does
line: 1
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/column_maximum_character_length.yaml b/backend/plugin/advisor/mysql/test/column_maximum_character_length.yaml
index ba36c9f8f4..7aa1b02db1 100644
--- a/backend/plugin/advisor/mysql/test/column_maximum_character_length.yaml
+++ b/backend/plugin/advisor/mysql/test/column_maximum_character_length.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE t(name varchar(225));
want:
- status: SUCCESS
@@ -12,6 +13,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE t(name char(225));
want:
- status: WARN
@@ -19,6 +21,7 @@
title: column.maximum-character-length
content: The length of the CHAR column `name` is bigger than 20, please use VARCHAR instead
line: 1
+ details: ""
- statement: ALTER TABLE tech_book ADD COLUMN name_2 char(225)
want:
- status: WARN
@@ -26,6 +29,7 @@
title: column.maximum-character-length
content: The length of the CHAR column `name_2` is bigger than 20, please use VARCHAR instead
line: 1
+ details: ""
- statement: ALTER TABLE tech_book CHANGE COLUMN name name char(225)
want:
- status: WARN
@@ -33,6 +37,7 @@
title: column.maximum-character-length
content: The length of the CHAR column `name` is bigger than 20, please use VARCHAR instead
line: 1
+ details: ""
- statement: ALTER TABLE tech_book MODIFY COLUMN name char(225)
want:
- status: WARN
@@ -40,3 +45,4 @@
title: column.maximum-character-length
content: The length of the CHAR column `name` is bigger than 20, please use VARCHAR instead
line: 1
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/column_no_null.yaml b/backend/plugin/advisor/mysql/test/column_no_null.yaml
index 1ab9977242..38e3dd70f4 100644
--- a/backend/plugin/advisor/mysql/test/column_no_null.yaml
+++ b/backend/plugin/advisor/mysql/test/column_no_null.yaml
@@ -8,11 +8,13 @@
title: column.no-null
content: '`book`.`id` cannot have NULL value'
line: 2
+ details: ""
- status: WARN
code: 402
title: column.no-null
content: '`book`.`name` cannot have NULL value'
line: 3
+ details: ""
- statement: CREATE TABLE book(id int PRIMARY KEY, name varchar(255))
want:
- status: WARN
@@ -20,6 +22,7 @@
title: column.no-null
content: '`book`.`name` cannot have NULL value'
line: 1
+ details: ""
- statement: CREATE TABLE book(id int NOT NULL, name varchar(255))
want:
- status: WARN
@@ -27,6 +30,7 @@
title: column.no-null
content: '`book`.`name` cannot have NULL value'
line: 1
+ details: ""
- statement: CREATE TABLE book(id int PRIMARY KEY, name varchar(255) NOT NULL)
want:
- status: SUCCESS
@@ -34,6 +38,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE book(a int NOT NULL);
ALTER TABLE book ADD COLUMN (id int, name varchar(255) NOT NULL);
@@ -43,6 +48,7 @@
title: column.no-null
content: '`book`.`id` cannot have NULL value'
line: 2
+ details: ""
- statement: |-
CREATE TABLE book(a int NOT NULL);
ALTER TABLE book ADD COLUMN (id int PRIMARY KEY, name varchar(255) NOT NULL);
@@ -52,6 +58,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE book(id int NOT NULL);
ALTER TABLE book CHANGE COLUMN id name varchar(255);
@@ -61,6 +68,7 @@
title: column.no-null
content: '`book`.`name` cannot have NULL value'
line: 2
+ details: ""
- statement: |-
CREATE TABLE book(id int NOT NULL);
ALTER TABLE book CHANGE COLUMN id name varchar(255) NOT NULL;
@@ -70,3 +78,4 @@
title: OK
content: ""
line: 0
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/column_require_default.yaml b/backend/plugin/advisor/mysql/test/column_require_default.yaml
index 3e02ab3101..342755ca06 100644
--- a/backend/plugin/advisor/mysql/test/column_require_default.yaml
+++ b/backend/plugin/advisor/mysql/test/column_require_default.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(
a int,
@@ -16,6 +17,7 @@
title: column.require-default
content: Column `t`.`a` doesn't have DEFAULT.
line: 2
+ details: ""
- statement: |-
ALTER TABLE tech_book ADD COLUMN a BLOB;
ALTER TABLE tech_book ADD COLUMN b timestamp;
@@ -26,8 +28,10 @@
title: column.require-default
content: Column `tech_book`.`b` doesn't have DEFAULT.
line: 2
+ details: ""
- status: WARN
code: 420
title: column.require-default
content: Column `tech_book`.`a` doesn't have DEFAULT.
line: 3
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/column_required.yaml b/backend/plugin/advisor/mysql/test/column_required.yaml
index b860fb4a44..09ae6cf94d 100644
--- a/backend/plugin/advisor/mysql/test/column_required.yaml
+++ b/backend/plugin/advisor/mysql/test/column_required.yaml
@@ -5,6 +5,7 @@
title: column.required
content: 'Table `book` requires columns: created_ts, creator_id, updated_ts, updater_id'
line: 1
+ details: ""
- statement: |-
CREATE TABLE book(
id int,
@@ -18,6 +19,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE book(
id int,
@@ -32,6 +34,7 @@
title: column.required
content: 'Table `book` requires columns: creator_id'
line: 7
+ details: ""
- statement: |-
CREATE TABLE book(
id int,
@@ -46,6 +49,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE book(
id int,
@@ -60,6 +64,7 @@
title: column.required
content: 'Table `book` requires columns: creator_id'
line: 7
+ details: ""
- statement: |-
CREATE TABLE book(
id int,
@@ -74,6 +79,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE book(
id int,
@@ -88,6 +94,7 @@
title: column.required
content: 'Table `book` requires columns: creator_id'
line: 7
+ details: ""
- statement: |-
CREATE TABLE book(
id int,
@@ -103,6 +110,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE book(
id int,
@@ -116,6 +124,7 @@
title: column.required
content: 'Table `book` requires columns: updater_id'
line: 5
+ details: ""
- statement: |-
CREATE TABLE book(
id int,
@@ -130,6 +139,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE book(
id int,
@@ -146,11 +156,13 @@
title: column.required
content: 'Table `book` requires columns: creator_id'
line: 5
+ details: ""
- status: WARN
code: 401
title: column.required
content: 'Table `student` requires columns: creator_id, updater_id'
line: 9
+ details: ""
- statement: |-
CREATE TABLE book(
id int,
@@ -165,3 +177,4 @@
title: OK
content: ""
line: 0
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/column_set_default_for_not_null.yaml b/backend/plugin/advisor/mysql/test/column_set_default_for_not_null.yaml
index 29af326aec..3a4b70ffd8 100644
--- a/backend/plugin/advisor/mysql/test/column_set_default_for_not_null.yaml
+++ b/backend/plugin/advisor/mysql/test/column_set_default_for_not_null.yaml
@@ -8,6 +8,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE book(
id int PRIMARY KEY
@@ -18,6 +19,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE book(
id int NOT NULL
@@ -28,6 +30,7 @@
title: column.set-default-for-not-null
content: Column `book`.`id` is NOT NULL but doesn't have DEFAULT
line: 2
+ details: ""
- statement: |-
CREATE TABLE book(
id int,
@@ -39,6 +42,7 @@
title: column.set-default-for-not-null
content: Column `book`.`id` is NOT NULL but doesn't have DEFAULT
line: 2
+ details: ""
- statement: |-
CREATE TABLE book(a int);
ALTER TABLE book ADD COLUMN id int PRIMARY KEY
@@ -48,6 +52,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE book(a int);
ALTER TABLE book ADD COLUMN id int NOT NULL
@@ -57,6 +62,7 @@
title: column.set-default-for-not-null
content: Column `book`.`id` is NOT NULL but doesn't have DEFAULT
line: 2
+ details: ""
- statement: |-
CREATE TABLE book(id int);
ALTER TABLE book MODIFY COLUMN id int NOT NULL
@@ -66,6 +72,7 @@
title: column.set-default-for-not-null
content: Column `book`.`id` is NOT NULL but doesn't have DEFAULT
line: 2
+ details: ""
- statement: |-
CREATE TABLE book(id int);
ALTER TABLE book MODIFY COLUMN id int PRIMARY KEY
@@ -75,6 +82,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE book(uid int);
ALTER TABLE book CHANGE COLUMN uid id int PRIMARY KEY
@@ -84,6 +92,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE book(uid int);
ALTER TABLE book CHANGE COLUMN uid id int NOT NULL
@@ -93,6 +102,7 @@
title: column.set-default-for-not-null
content: Column `book`.`id` is NOT NULL but doesn't have DEFAULT
line: 2
+ details: ""
- statement: "\n\t\t\t\tCREATE TABLE book(uid int, id int);\n\t\t\t\tALTER TABLE book \n\t\t\t\t\tCHANGE COLUMN uid uid int NOT NULL DEFAULT 0,\n\t\t\t\t\tMODIFY COLUMN id int PRIMARY KEY DEFAULT 0,\n\t\t\t\t\tADD COLUMN name varchar(20) NOT NULL DEFAULT ''\n\t\t\t\t"
want:
- status: SUCCESS
@@ -100,3 +110,4 @@
title: OK
content: ""
line: 0
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/column_type_disallow_list.yaml b/backend/plugin/advisor/mysql/test/column_type_disallow_list.yaml
index 1f90918f1c..2f6fb9e6d6 100644
--- a/backend/plugin/advisor/mysql/test/column_type_disallow_list.yaml
+++ b/backend/plugin/advisor/mysql/test/column_type_disallow_list.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE t(a JSON, b BLOB, c TEXT)
want:
- status: WARN
@@ -12,6 +13,7 @@
title: column.type-disallow-list
content: Disallow column type JSON but column `t`.`a` is
line: 1
+ details: ""
- statement: |-
CREATE TABLE t(d int);
ALTER TABLE t add COLUMN (a JSON, b BLOB, c TEXT)
@@ -21,6 +23,7 @@
title: column.type-disallow-list
content: Disallow column type JSON but column `t`.`a` is
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(c int, b int);
ALTER TABLE t CHANGE COLUMN c a JSON, MODIFY b BLOB
@@ -30,3 +33,4 @@
title: column.type-disallow-list
content: Disallow column type JSON but column `t`.`a` is
line: 2
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/database_drop_empty_database.yaml b/backend/plugin/advisor/mysql/test/database_drop_empty_database.yaml
index 7baaf278d4..ddaa830fbb 100644
--- a/backend/plugin/advisor/mysql/test/database_drop_empty_database.yaml
+++ b/backend/plugin/advisor/mysql/test/database_drop_empty_database.yaml
@@ -5,3 +5,4 @@
title: database.drop-empty-database
content: Database `test` is not allowed to drop if not empty
line: 1
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/engine_mysql_use_innodb.yaml b/backend/plugin/advisor/mysql/test/engine_mysql_use_innodb.yaml
index 93e84e11ef..94eba64411 100644
--- a/backend/plugin/advisor/mysql/test/engine_mysql_use_innodb.yaml
+++ b/backend/plugin/advisor/mysql/test/engine_mysql_use_innodb.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE book(id int)
want:
- status: SUCCESS
@@ -12,6 +13,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE book(id int) ENGINE = CSV
want:
- status: WARN
@@ -19,6 +21,7 @@
title: engine.mysql.use-innodb
content: '"CREATE TABLE book(id int) ENGINE = CSV" doesn''t use InnoDB engine'
line: 1
+ details: ""
- statement: ALTER TABLE tech_book ENGINE = INNODB
want:
- status: SUCCESS
@@ -26,6 +29,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: ALTER TABLE tech_book ENGINE = CSV
want:
- status: WARN
@@ -33,6 +37,7 @@
title: engine.mysql.use-innodb
content: '"ALTER TABLE tech_book ENGINE = CSV" doesn''t use InnoDB engine'
line: 1
+ details: ""
- statement: SET default_storage_engine=INNODB
want:
- status: SUCCESS
@@ -40,6 +45,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: SET default_storage_engine=CSV
want:
- status: WARN
@@ -47,3 +53,4 @@
title: engine.mysql.use-innodb
content: '"SET default_storage_engine=CSV" doesn''t use InnoDB engine'
line: 1
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/index_key_number_limit.yaml b/backend/plugin/advisor/mysql/test/index_key_number_limit.yaml
index 1cd22615c2..fed362f8a2 100644
--- a/backend/plugin/advisor/mysql/test/index_key_number_limit.yaml
+++ b/backend/plugin/advisor/mysql/test/index_key_number_limit.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(
a int,
@@ -16,6 +17,7 @@
title: index.key-number-limit
content: The number of index `pk` in table `t` should be not greater than 5
line: 4
+ details: ""
- statement: |-
CREATE TABLE t(a int, b int, c int, d int, e int, f int, g int);
CREATE INDEX idx ON t(a, b, c, d, e, f, g)
@@ -25,6 +27,7 @@
title: index.key-number-limit
content: The number of index `idx` in table `t` should be not greater than 5
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(a int, b int, c int, d int, e int, f int, g int);
ALTER TABLE t ADD UNIQUE KEY uk (a, b, c, d, e, f, g)
@@ -34,6 +37,7 @@
title: index.key-number-limit
content: The number of index `uk` in table `t` should be not greater than 5
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(a int, b int, c int, d int, e int, f int, g int);
ALTER TABLE t ADD FOREIGN KEY uk (a, b, c, d, e, f, g) REFERENCES t1(a, b, c, d, e, f, g)
@@ -43,3 +47,4 @@
title: index.key-number-limit
content: The number of index `uk` in table `t` should be not greater than 5
line: 2
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/index_no_duplicate_column.yaml b/backend/plugin/advisor/mysql/test/index_no_duplicate_column.yaml
index 62045e5c5d..8daa2383fe 100644
--- a/backend/plugin/advisor/mysql/test/index_no_duplicate_column.yaml
+++ b/backend/plugin/advisor/mysql/test/index_no_duplicate_column.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t (
a int,
@@ -15,6 +16,7 @@
title: index.no-duplicate-column
content: INDEX `idx_a` has duplicate column `t`.`a`
line: 3
+ details: ""
- statement: |-
CREATE TABLE t(a int);
CREATE INDEX idx_a on t(a, a)
@@ -24,6 +26,7 @@
title: index.no-duplicate-column
content: INDEX `idx_a` has duplicate column `t`.`a`
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD INDEX idx_a (a, a)
@@ -33,6 +36,7 @@
title: index.no-duplicate-column
content: INDEX `idx_a` has duplicate column `t`.`a`
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD PRIMARY KEY pk_a (a, a)
@@ -42,6 +46,7 @@
title: index.no-duplicate-column
content: PRIMARY KEY `pk_a` has duplicate column `t`.`a`
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD UNIQUE KEY uk_a (a, a)
@@ -51,6 +56,7 @@
title: index.no-duplicate-column
content: UNIQUE KEY `uk_a` has duplicate column `t`.`a`
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD FOREIGN KEY fk_a (a, a) REFERENCES t1(a, b)
@@ -60,3 +66,4 @@
title: index.no-duplicate-column
content: FOREIGN KEY `fk_a` has duplicate column `t`.`a`
line: 2
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/index_pk_type_limit.yaml b/backend/plugin/advisor/mysql/test/index_pk_type_limit.yaml
index 2817902c47..24627976e5 100644
--- a/backend/plugin/advisor/mysql/test/index_pk_type_limit.yaml
+++ b/backend/plugin/advisor/mysql/test/index_pk_type_limit.yaml
@@ -5,6 +5,7 @@
title: index.pk-type-limit
content: Columns in primary key must be INT/BIGINT but `t`.`id` is varchar(5)
line: 1
+ details: ""
- statement: CREATE TABLE t(id INT PRIMARY KEY)
want:
- status: SUCCESS
@@ -12,6 +13,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE t(id VARCHAR(5), PRIMARY KEY(id))
want:
- status: WARN
@@ -19,6 +21,7 @@
title: index.pk-type-limit
content: Columns in primary key must be INT/BIGINT but `t`.`id` is varchar(5)
line: 1
+ details: ""
- statement: CREATE TABLE t(id INT, id2 VARCHAR(5), id3 VARCHAR(5), PRIMARY KEY(id, id2, id3))
want:
- status: WARN
@@ -26,11 +29,13 @@
title: index.pk-type-limit
content: Columns in primary key must be INT/BIGINT but `t`.`id2` is varchar(5)
line: 1
+ details: ""
- status: WARN
code: 803
title: index.pk-type-limit
content: Columns in primary key must be INT/BIGINT but `t`.`id3` is varchar(5)
line: 1
+ details: ""
- statement: CREATE TABLE t(id INT, id2 BIGINT, PRIMARY KEY(id, id2))
want:
- status: SUCCESS
@@ -38,6 +43,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE t(id INT, PRIMARY KEY(id))
want:
- status: SUCCESS
@@ -45,6 +51,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN id VARCHAR(5) PRIMARY KEY
@@ -54,6 +61,7 @@
title: index.pk-type-limit
content: Columns in primary key must be INT/BIGINT but `t`.`id` is varchar(5)
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN id INT PRIMARY KEY
@@ -63,6 +71,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN id VARCHAR(5), ADD PRIMARY KEY (id)
@@ -72,6 +81,7 @@
title: index.pk-type-limit
content: Columns in primary key must be INT/BIGINT but `t`.`id` is varchar(5)
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN id INT, ADD COLUMN id2 VARCHAR(5), ADD COLUMN id3 VARCHAR(5), ADD PRIMARY KEY (id, id2, id3)
@@ -81,11 +91,13 @@
title: index.pk-type-limit
content: Columns in primary key must be INT/BIGINT but `t`.`id2` is varchar(5)
line: 2
+ details: ""
- status: WARN
code: 803
title: index.pk-type-limit
content: Columns in primary key must be INT/BIGINT but `t`.`id3` is varchar(5)
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN id INT, ADD COLUMN id2 BIGINT, ADD PRIMARY KEY (id, id2)
@@ -95,6 +107,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN id BIGINT, ADD PRIMARY KEY (id)
@@ -104,6 +117,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(id VARCHAR(5));
ALTER TABLE t ADD PRIMARY KEY(id);
@@ -113,6 +127,7 @@
title: index.pk-type-limit
content: Columns in primary key must be INT/BIGINT but `t`.`id` is varchar(5)
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(id INT, id2 VARCHAR(5), id3 VARCHAR(5));
ALTER TABLE t ADD PRIMARY KEY(id, id2, id3);
@@ -122,11 +137,13 @@
title: index.pk-type-limit
content: Columns in primary key must be INT/BIGINT but `t`.`id2` is varchar(5)
line: 2
+ details: ""
- status: WARN
code: 803
title: index.pk-type-limit
content: Columns in primary key must be INT/BIGINT but `t`.`id3` is varchar(5)
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(id INT, id2 BIGINT);
ALTER TABLE t ADD PRIMARY KEY(id, id2);
@@ -136,6 +153,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(id BIGINT);
ALTER TABLE t ADD PRIMARY KEY(id);
@@ -145,6 +163,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(id int);
ALTER TABLE t MODIFY COLUMN id VARCHAR(5) PRIMARY KEY;
@@ -154,6 +173,7 @@
title: index.pk-type-limit
content: Columns in primary key must be INT/BIGINT but `t`.`id` is varchar(5)
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(id int);
ALTER TABLE t MODIFY COLUMN id INT(5) PRIMARY KEY;
@@ -163,6 +183,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(id int);
ALTER TABLE t CHANGE COLUMN id id2 VARCHAR(5) PRIMARY KEY
@@ -172,6 +193,7 @@
title: index.pk-type-limit
content: Columns in primary key must be INT/BIGINT but `t`.`id2` is varchar(5)
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(id int);
ALTER TABLE t CHANGE COLUMN id id2 INT(5) PRIMARY KEY
@@ -181,3 +203,4 @@
title: OK
content: ""
line: 0
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/index_primary_key_type_allowlist.yaml b/backend/plugin/advisor/mysql/test/index_primary_key_type_allowlist.yaml
index 94806560dd..f146fb554a 100644
--- a/backend/plugin/advisor/mysql/test/index_primary_key_type_allowlist.yaml
+++ b/backend/plugin/advisor/mysql/test/index_primary_key_type_allowlist.yaml
@@ -5,6 +5,7 @@
title: index.primary-key-type-allowlist
content: The column `id` in table `t` is one of the primary key, but its type "varchar" is not in allowlist
line: 1
+ details: ""
- statement: CREATE TABLE t(id INT PRIMARY KEY)
want:
- status: SUCCESS
@@ -12,6 +13,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE t(id VARCHAR(5), PRIMARY KEY(id))
want:
- status: WARN
@@ -19,6 +21,7 @@
title: index.primary-key-type-allowlist
content: The column `id` in table `t` is one of the primary key, but its type "varchar" is not in allowlist
line: 1
+ details: ""
- statement: CREATE TABLE t(id INT, id2 VARCHAR(5), id3 VARCHAR(5), PRIMARY KEY(id, id2, id3))
want:
- status: WARN
@@ -26,11 +29,13 @@
title: index.primary-key-type-allowlist
content: The column `id2` in table `t` is one of the primary key, but its type "varchar" is not in allowlist
line: 1
+ details: ""
- status: WARN
code: 803
title: index.primary-key-type-allowlist
content: The column `id3` in table `t` is one of the primary key, but its type "varchar" is not in allowlist
line: 1
+ details: ""
- statement: CREATE TABLE t(id INT, id2 BIGINT, PRIMARY KEY(id, id2))
want:
- status: SUCCESS
@@ -38,6 +43,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE t(id INT, PRIMARY KEY(id))
want:
- status: SUCCESS
@@ -45,6 +51,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN id VARCHAR(5) PRIMARY KEY
@@ -54,6 +61,7 @@
title: index.primary-key-type-allowlist
content: The column `id` in table `t` is one of the primary key, but its type "varchar" is not in allowlist
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN id INT PRIMARY KEY
@@ -63,6 +71,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN id VARCHAR(5), ADD PRIMARY KEY (id)
@@ -72,6 +81,7 @@
title: index.primary-key-type-allowlist
content: The column `id` in table `t` is one of the primary key, but its type "varchar" is not in allowlist
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN id INT, ADD COLUMN id2 VARCHAR(5), ADD COLUMN id3 VARCHAR(5), ADD PRIMARY KEY (id, id2, id3)
@@ -81,11 +91,13 @@
title: index.primary-key-type-allowlist
content: The column `id2` in table `t` is one of the primary key, but its type "varchar" is not in allowlist
line: 2
+ details: ""
- status: WARN
code: 803
title: index.primary-key-type-allowlist
content: The column `id3` in table `t` is one of the primary key, but its type "varchar" is not in allowlist
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN id INT, ADD COLUMN id2 BIGINT, ADD PRIMARY KEY (id, id2)
@@ -95,6 +107,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN id BIGINT, ADD PRIMARY KEY (id)
@@ -104,6 +117,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(id VARCHAR(5));
ALTER TABLE t ADD PRIMARY KEY(id);
@@ -113,6 +127,7 @@
title: index.primary-key-type-allowlist
content: The column `id` in table `t` is one of the primary key, but its type "varchar" is not in allowlist
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(id INT, id2 VARCHAR(5), id3 VARCHAR(5));
ALTER TABLE t ADD PRIMARY KEY(id, id2, id3);
@@ -122,11 +137,13 @@
title: index.primary-key-type-allowlist
content: The column `id2` in table `t` is one of the primary key, but its type "varchar" is not in allowlist
line: 2
+ details: ""
- status: WARN
code: 803
title: index.primary-key-type-allowlist
content: The column `id3` in table `t` is one of the primary key, but its type "varchar" is not in allowlist
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(id INT, id2 BIGINT);
ALTER TABLE t ADD PRIMARY KEY(id, id2);
@@ -136,6 +153,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(id BIGINT);
ALTER TABLE t ADD PRIMARY KEY(id);
@@ -145,6 +163,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(id int);
ALTER TABLE t MODIFY COLUMN id VARCHAR(5) PRIMARY KEY;
@@ -154,6 +173,7 @@
title: index.primary-key-type-allowlist
content: The column `id` in table `t` is one of the primary key, but its type "varchar" is not in allowlist
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(id int);
ALTER TABLE t MODIFY COLUMN id INT(5) PRIMARY KEY;
@@ -163,6 +183,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(id int);
ALTER TABLE t CHANGE COLUMN id id2 VARCHAR(5) PRIMARY KEY
@@ -172,6 +193,7 @@
title: index.primary-key-type-allowlist
content: The column `id2` in table `t` is one of the primary key, but its type "varchar" is not in allowlist
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(id int);
ALTER TABLE t CHANGE COLUMN id id2 INT(5) PRIMARY KEY
@@ -181,3 +203,4 @@
title: OK
content: ""
line: 0
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/index_total_number_limit.yaml b/backend/plugin/advisor/mysql/test/index_total_number_limit.yaml
index 45edd91c35..ddb832a98c 100644
--- a/backend/plugin/advisor/mysql/test/index_total_number_limit.yaml
+++ b/backend/plugin/advisor/mysql/test/index_total_number_limit.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE INDEX idx_id_name on tech_book(id, name)
want:
- status: SUCCESS
@@ -12,6 +13,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE INDEX idx_id_name_1 on tech_book(id, name);
CREATE INDEX idx_id_name_2 on tech_book(id, name);
@@ -24,6 +26,7 @@
title: index.total-number-limit
content: The count of index in table `tech_book` should be no more than 5, but found 8
line: 5
+ details: ""
- statement: |-
CREATE TABLE t(a int PRIMARY KEY, b int, c int);
CREATE INDEX idx_a_b_1 on t(a, b);
@@ -37,6 +40,7 @@
title: index.total-number-limit
content: The count of index in table `t` should be no more than 5, but found 6
line: 6
+ details: ""
- statement: |-
CREATE TABLE t(
a int PRIMARY KEY,
@@ -53,3 +57,4 @@
title: index.total-number-limit
content: The count of index in table `t` should be no more than 5, but found 6
line: 9
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/index_type_no_blob.yaml b/backend/plugin/advisor/mysql/test/index_type_no_blob.yaml
index dc2d342e28..0442d9a067 100644
--- a/backend/plugin/advisor/mysql/test/index_type_no_blob.yaml
+++ b/backend/plugin/advisor/mysql/test/index_type_no_blob.yaml
@@ -5,6 +5,7 @@
title: index.type-no-blob
content: Columns in index must not be BLOB but `t`.`b` is blob
line: 1
+ details: ""
- statement: CREATE TABLE t(b BLOB, mb MEDIUMBLOB, lb LONGBLOB, id INT, PRIMARY KEY(b(1), mb(2), lb(3), id))
want:
- status: WARN
@@ -12,16 +13,19 @@
title: index.type-no-blob
content: Columns in index must not be BLOB but `t`.`b` is blob
line: 1
+ details: ""
- status: WARN
code: 804
title: index.type-no-blob
content: Columns in index must not be BLOB but `t`.`mb` is mediumblob
line: 1
+ details: ""
- status: WARN
code: 804
title: index.type-no-blob
content: Columns in index must not be BLOB but `t`.`lb` is longblob
line: 1
+ details: ""
- statement: CREATE TABLE t(b BLOB, mb MEDIUMBLOB, lb LONGBLOB, id INT, UNIQUE INDEX(b(1), mb(2), lb(3), id))
want:
- status: WARN
@@ -29,16 +33,19 @@
title: index.type-no-blob
content: Columns in index must not be BLOB but `t`.`b` is blob
line: 1
+ details: ""
- status: WARN
code: 804
title: index.type-no-blob
content: Columns in index must not be BLOB but `t`.`mb` is mediumblob
line: 1
+ details: ""
- status: WARN
code: 804
title: index.type-no-blob
content: Columns in index must not be BLOB but `t`.`lb` is longblob
line: 1
+ details: ""
- statement: CREATE TABLE t(b BLOB, mb MEDIUMBLOB, lb LONGBLOB, id iNT, INDEX(b(1), mb(2), lb(3), id))
want:
- status: WARN
@@ -46,16 +53,19 @@
title: index.type-no-blob
content: Columns in index must not be BLOB but `t`.`b` is blob
line: 1
+ details: ""
- status: WARN
code: 804
title: index.type-no-blob
content: Columns in index must not be BLOB but `t`.`mb` is mediumblob
line: 1
+ details: ""
- status: WARN
code: 804
title: index.type-no-blob
content: Columns in index must not be BLOB but `t`.`lb` is longblob
line: 1
+ details: ""
- statement: CREATE TABLE t(id INT, PRIMARY KEY(id))
want:
- status: SUCCESS
@@ -63,6 +73,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN b BLOB, ADD COLUMN id INT, ADD PRIMARY KEY(b(1), id)
@@ -72,6 +83,7 @@
title: index.type-no-blob
content: Columns in index must not be BLOB but `t`.`b` is blob
line: 2
+ details: ""
- 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 UNIQUE INDEX(b(1), mb(2), lb(3), id)
@@ -81,16 +93,19 @@
title: index.type-no-blob
content: Columns in index must not be BLOB but `t`.`b` is blob
line: 2
+ details: ""
- status: WARN
code: 804
title: index.type-no-blob
content: Columns in index must not be BLOB but `t`.`mb` is mediumblob
line: 2
+ details: ""
- status: WARN
code: 804
title: index.type-no-blob
content: Columns in index must not be BLOB but `t`.`lb` is longblob
line: 2
+ details: ""
- 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(b(1), mb(2), lb(3), id)
@@ -100,16 +115,19 @@
title: index.type-no-blob
content: Columns in index must not be BLOB but `t`.`b` is blob
line: 2
+ details: ""
- status: WARN
code: 804
title: index.type-no-blob
content: Columns in index must not be BLOB but `t`.`mb` is mediumblob
line: 2
+ details: ""
- status: WARN
code: 804
title: index.type-no-blob
content: Columns in index must not be BLOB but `t`.`lb` is longblob
line: 2
+ details: ""
- 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)
@@ -119,6 +137,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(b blob, mb mediumblob, lb longblob, id int);
CREATE INDEX idx_b ON t(b(5));
@@ -131,16 +150,19 @@
title: index.type-no-blob
content: Columns in index must not be BLOB but `t`.`b` is blob
line: 2
+ details: ""
- status: WARN
code: 804
title: index.type-no-blob
content: Columns in index must not be BLOB but `t`.`mb` is mediumblob
line: 3
+ details: ""
- status: WARN
code: 804
title: index.type-no-blob
content: Columns in index must not be BLOB but `t`.`lb` is longblob
line: 4
+ details: ""
- statement: |-
CREATE TABLE t(b blob, mb mediumblob, lb longblob, id int);
CREATE INDEX idx_id ON t(id);
@@ -150,3 +172,4 @@
title: OK
content: ""
line: 0
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/naming_column.yaml b/backend/plugin/advisor/mysql/test/naming_column.yaml
index 20f1405c65..1ce2ecf64c 100644
--- a/backend/plugin/advisor/mysql/test/naming_column.yaml
+++ b/backend/plugin/advisor/mysql/test/naming_column.yaml
@@ -5,6 +5,7 @@
title: naming.column
content: '`book`.`creatorId` mismatches column naming convention, naming format should be "^[a-z]+(_[a-z]+)*$"'
line: 1
+ details: ""
- statement: CREATE TABLE book(id int, gbhzmtchhsjzyrhdroxmyouwloxqezowdvhcbqalqcgqhfbjnvmhwrbggezmzeusx int)
want:
- status: WARN
@@ -12,6 +13,7 @@
title: naming.column
content: '`book`.`gbhzmtchhsjzyrhdroxmyouwloxqezowdvhcbqalqcgqhfbjnvmhwrbggezmzeusx` mismatches column naming convention, its length should be within 64 characters'
line: 1
+ details: ""
- statement: CREATE TABLE book(id int, creator_id int)
want:
- status: SUCCESS
@@ -19,6 +21,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE book(id int, creator_id int);
ALTER TABLE book RENAME COLUMN creator_id TO creatorId
@@ -28,6 +31,7 @@
title: naming.column
content: '`book`.`creatorId` mismatches column naming convention, naming format should be "^[a-z]+(_[a-z]+)*$"'
line: 2
+ details: ""
- statement: ALTER TABLE tech_book RENAME COLUMN id TO creator_id;
want:
- status: SUCCESS
@@ -35,6 +39,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE book(
id int,
@@ -49,6 +54,7 @@
title: naming.column
content: '`book`.`creatorId` mismatches column naming convention, naming format should be "^[a-z]+(_[a-z]+)*$"'
line: 7
+ details: ""
- statement: ALTER TABLE tech_book CHANGE COLUMN id creator_id int;
want:
- status: SUCCESS
@@ -56,6 +62,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: ALTER TABLE tech_book DROP COLUMN id;
want:
- status: SUCCESS
@@ -63,6 +70,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE book(
id int,
@@ -76,6 +84,7 @@
title: naming.column
content: '`book`.`contentString` mismatches column naming convention, naming format should be "^[a-z]+(_[a-z]+)*$"'
line: 6
+ details: ""
- statement: |-
CREATE TABLE book(
id int,
@@ -92,18 +101,22 @@
title: naming.column
content: '`book`.`createdTs` mismatches column naming convention, naming format should be "^[a-z]+(_[a-z]+)*$"'
line: 3
+ details: ""
- status: WARN
code: 302
title: naming.column
content: '`book`.`updaterId` mismatches column naming convention, naming format should be "^[a-z]+(_[a-z]+)*$"'
line: 4
+ details: ""
- status: WARN
code: 302
title: naming.column
content: '`student`.`createdTs` mismatches column naming convention, naming format should be "^[a-z]+(_[a-z]+)*$"'
line: 8
+ details: ""
- status: WARN
code: 302
title: naming.column
content: '`student`.`updatedTs` mismatches column naming convention, naming format should be "^[a-z]+(_[a-z]+)*$"'
line: 9
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/naming_column_auto_increment.yaml b/backend/plugin/advisor/mysql/test/naming_column_auto_increment.yaml
index 3ea6409ab5..3201a6a383 100644
--- a/backend/plugin/advisor/mysql/test/naming_column_auto_increment.yaml
+++ b/backend/plugin/advisor/mysql/test/naming_column_auto_increment.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE book(a int AUTO_INCREMENT)
want:
- status: WARN
@@ -12,6 +13,7 @@
title: naming.column.auto-increment
content: '`book`.`a` mismatches auto_increment column naming convention, naming format should be "^id$"'
line: 1
+ details: ""
- statement: ALTER TABLE tech_book ADD COLUMN a int AUTO_INCREMENT
want:
- status: WARN
@@ -19,6 +21,7 @@
title: naming.column.auto-increment
content: '`tech_book`.`a` mismatches auto_increment column naming convention, naming format should be "^id$"'
line: 1
+ details: ""
- statement: ALTER TABLE tech_book CHANGE COLUMN id a int AUTO_INCREMENT
want:
- status: WARN
@@ -26,6 +29,7 @@
title: naming.column.auto-increment
content: '`tech_book`.`a` mismatches auto_increment column naming convention, naming format should be "^id$"'
line: 1
+ details: ""
- statement: ALTER TABLE tech_book MODIFY COLUMN name int AUTO_INCREMENT
want:
- status: WARN
@@ -33,3 +37,4 @@
title: naming.column.auto-increment
content: '`tech_book`.`name` mismatches auto_increment column naming convention, naming format should be "^id$"'
line: 1
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/naming_index_fk.yaml b/backend/plugin/advisor/mysql/test/naming_index_fk.yaml
index 74643398e4..112616d4c5 100644
--- a/backend/plugin/advisor/mysql/test/naming_index_fk.yaml
+++ b/backend/plugin/advisor/mysql/test/naming_index_fk.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: ALTER TABLE tech_book ADD CONSTRAINT fk_author_id FOREIGN KEY (author_id) REFERENCES author (id)
want:
- status: WARN
@@ -12,6 +13,7 @@
title: naming.index.fk
content: Foreign key in table `tech_book` mismatches the naming convention, expect "^$|^fk_tech_book_author_id_author_id$" but found `fk_author_id`
line: 1
+ details: ""
- statement: ALTER TABLE tech_book ADD CONSTRAINT rvemempmcmmhutaskvcidmwaldtfjdgmcpkhmibtadfydtkexpuzczrrneucthfwk FOREIGN KEY (author_id) REFERENCES author (id)
want:
- status: WARN
@@ -19,11 +21,13 @@
title: naming.index.fk
content: Foreign key in table `tech_book` mismatches the naming convention, expect "^$|^fk_tech_book_author_id_author_id$" but found `rvemempmcmmhutaskvcidmwaldtfjdgmcpkhmibtadfydtkexpuzczrrneucthfwk`
line: 1
+ details: ""
- status: WARN
code: 305
title: naming.index.fk
content: Foreign key `rvemempmcmmhutaskvcidmwaldtfjdgmcpkhmibtadfydtkexpuzczrrneucthfwk` in table `tech_book` mismatches the naming convention, its length should be within 64 characters
line: 1
+ details: ""
- statement: CREATE TABLE book(id INT, author_id INT, FOREIGN KEY fk_book_author_id_author_id (author_id) REFERENCES author (id))
want:
- status: SUCCESS
@@ -31,6 +35,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE book(id INT, author_id INT, FOREIGN KEY (author_id) REFERENCES author (id))
want:
- status: SUCCESS
@@ -38,6 +43,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE book(id INT, author_id INT, FOREIGN KEY fk_book_author_id (author_id) REFERENCES author (id))
want:
- status: WARN
@@ -45,3 +51,4 @@
title: naming.index.fk
content: Foreign key in table `book` mismatches the naming convention, expect "^$|^fk_book_author_id_author_id$" but found `fk_book_author_id`
line: 1
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/naming_index_idx.yaml b/backend/plugin/advisor/mysql/test/naming_index_idx.yaml
index 4461459a28..79a89fa586 100644
--- a/backend/plugin/advisor/mysql/test/naming_index_idx.yaml
+++ b/backend/plugin/advisor/mysql/test/naming_index_idx.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE INDEX tech_book_id_name ON tech_book(id, name)
want:
- status: WARN
@@ -12,6 +13,7 @@
title: naming.index.idx
content: Index in table `tech_book` mismatches the naming convention, expect "^$|^idx_tech_book_id_name$" but found `tech_book_id_name`
line: 1
+ details: ""
- statement: CREATE INDEX afvjwsgrbgqzjfrkmbcoxzstznuypasijbbcdykoboredqovetzfcmmqliaelyavw ON tech_book(id, name)
want:
- status: WARN
@@ -19,11 +21,13 @@
title: naming.index.idx
content: Index in table `tech_book` mismatches the naming convention, expect "^$|^idx_tech_book_id_name$" but found `afvjwsgrbgqzjfrkmbcoxzstznuypasijbbcdykoboredqovetzfcmmqliaelyavw`
line: 1
+ details: ""
- status: WARN
code: 303
title: naming.index.idx
content: Index `afvjwsgrbgqzjfrkmbcoxzstznuypasijbbcdykoboredqovetzfcmmqliaelyavw` in table `tech_book` mismatches the naming convention, its length should be within 64 characters
line: 1
+ details: ""
- statement: ALTER TABLE tech_book RENAME INDEX old_index TO idx_tech_book_id_name
want:
- status: SUCCESS
@@ -31,6 +35,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: ALTER TABLE tech_book RENAME INDEX old_index TO idx_tech_book
want:
- status: WARN
@@ -38,6 +43,7 @@
title: naming.index.idx
content: Index in table `tech_book` mismatches the naming convention, expect "^$|^idx_tech_book_id_name$" but found `idx_tech_book`
line: 1
+ details: ""
- statement: ALTER TABLE tech_book ADD INDEX idx_tech_book_id_name (id, name)
want:
- status: SUCCESS
@@ -45,6 +51,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: ALTER TABLE tech_book ADD INDEX tech_book_id_name (id, name)
want:
- status: WARN
@@ -52,6 +59,7 @@
title: naming.index.idx
content: Index in table `tech_book` mismatches the naming convention, expect "^$|^idx_tech_book_id_name$" but found `tech_book_id_name`
line: 1
+ details: ""
- statement: CREATE TABLE tech_book_copy(id INT PRIMARY KEY, name VARCHAR(20), INDEX idx_tech_book_copy_name (name))
want:
- status: SUCCESS
@@ -59,6 +67,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE tech_book_copy(id INT PRIMARY KEY, name VARCHAR(20), INDEX (name))
want:
- status: SUCCESS
@@ -66,3 +75,4 @@
title: OK
content: ""
line: 0
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/naming_index_uk.yaml b/backend/plugin/advisor/mysql/test/naming_index_uk.yaml
index d3efefd84f..bb03ac33e9 100644
--- a/backend/plugin/advisor/mysql/test/naming_index_uk.yaml
+++ b/backend/plugin/advisor/mysql/test/naming_index_uk.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE UNIQUE INDEX tech_book_id_name ON tech_book(id, name)
want:
- status: WARN
@@ -12,6 +13,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: 1
+ details: ""
- statement: CREATE UNIQUE INDEX qtzmquwvlnttctfluoouxelxeliltcfzzstrtyocogwwyiyrflmrkbhbfasynlacy ON tech_book(id, name)
want:
- status: WARN
@@ -19,11 +21,13 @@
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: 1
+ details: ""
- status: WARN
code: 304
title: naming.index.uk
content: Unique key `qtzmquwvlnttctfluoouxelxeliltcfzzstrtyocogwwyiyrflmrkbhbfasynlacy` in table `tech_book` mismatches the naming convention, its length should be within 64 characters
line: 1
+ details: ""
- statement: ALTER TABLE tech_book ADD UNIQUE uk_tech_book_id_name (id, name)
want:
- status: SUCCESS
@@ -31,6 +35,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: ALTER TABLE tech_book ADD UNIQUE tech_book_id_name (id, name)
want:
- status: WARN
@@ -38,6 +43,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: 1
+ details: ""
- statement: ALTER TABLE tech_book RENAME INDEX old_uk TO uk_tech_book_id_name
want:
- status: SUCCESS
@@ -45,6 +51,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: ALTER TABLE tech_book RENAME INDEX old_uk TO uk_tech_book
want:
- status: WARN
@@ -52,6 +59,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: 1
+ details: ""
- statement: CREATE TABLE book(id INT PRIMARY KEY, name VARCHAR(20), UNIQUE INDEX uk_book_name (name))
want:
- status: SUCCESS
@@ -59,6 +67,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE book(id INT PRIMARY KEY, name VARCHAR(20), UNIQUE KEY (name))
want:
- status: SUCCESS
@@ -66,6 +75,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE book(id INT PRIMARY KEY, name VARCHAR(20), UNIQUE INDEX (name))
want:
- status: SUCCESS
@@ -73,3 +83,4 @@
title: OK
content: ""
line: 0
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/naming_table.yaml b/backend/plugin/advisor/mysql/test/naming_table.yaml
index 4a7a95da34..a7e411fef3 100644
--- a/backend/plugin/advisor/mysql/test/naming_table.yaml
+++ b/backend/plugin/advisor/mysql/test/naming_table.yaml
@@ -5,6 +5,7 @@
title: naming.table
content: '`techBook` mismatches table naming convention, naming format should be "^[a-z]+(_[a-z]+)*$"'
line: 1
+ details: ""
- statement: CREATE TABLE tech_book_copy(id int, name varchar(255))
want:
- status: SUCCESS
@@ -12,6 +13,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE cjnubexocfhqoogdmihudyahmmghviqkzvpixnwvxtxumvuannpwdcbtsgwrvzpde(id int, name varchar(255))
want:
- status: WARN
@@ -19,6 +21,7 @@
title: naming.table
content: '`cjnubexocfhqoogdmihudyahmmghviqkzvpixnwvxtxumvuannpwdcbtsgwrvzpde` mismatches table naming convention, its length should be within 64 characters'
line: 1
+ details: ""
- statement: ALTER TABLE tech_book RENAME TO TechBook
want:
- status: WARN
@@ -26,6 +29,7 @@
title: naming.table
content: '`TechBook` mismatches table naming convention, naming format should be "^[a-z]+(_[a-z]+)*$"'
line: 1
+ details: ""
- statement: ALTER TABLE tech_book RENAME TO tech_book_copy
want:
- status: SUCCESS
@@ -33,6 +37,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: RENAME TABLE tech_book TO tech_book_copy, tech_book_copy TO LiteraryBook
want:
- status: WARN
@@ -40,6 +45,7 @@
title: naming.table
content: '`LiteraryBook` mismatches table naming convention, naming format should be "^[a-z]+(_[a-z]+)*$"'
line: 1
+ details: ""
- statement: CREATE TABLE literary_book(a int);RENAME TABLE tech_book TO TechBook, literary_book TO LiteraryBook
want:
- status: WARN
@@ -47,11 +53,13 @@
title: naming.table
content: '`TechBook` mismatches table naming convention, naming format should be "^[a-z]+(_[a-z]+)*$"'
line: 1
+ details: ""
- status: WARN
code: 301
title: naming.table
content: '`LiteraryBook` mismatches table naming convention, naming format should be "^[a-z]+(_[a-z]+)*$"'
line: 1
+ details: ""
- statement: CREATE TABLE literary_book(a int);RENAME TABLE tech_book TO tech_book_copy, literary_book TO literary_book_copy
want:
- status: SUCCESS
@@ -59,3 +67,4 @@
title: OK
content: ""
line: 0
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/schema_backward_compatibility.yaml b/backend/plugin/advisor/mysql/test/schema_backward_compatibility.yaml
index 5ed20c9ff5..c75a85a891 100644
--- a/backend/plugin/advisor/mysql/test/schema_backward_compatibility.yaml
+++ b/backend/plugin/advisor/mysql/test/schema_backward_compatibility.yaml
@@ -5,6 +5,7 @@
title: schema.backward-compatibility
content: '"ALTER TABLE tech_book CHANGE name f2 TEXT" may cause incompatibility with the existing data and code'
line: 1
+ details: ""
- statement: ALTER TABLE tech_book MODIFY name TEXT
want:
- status: WARN
@@ -12,6 +13,7 @@
title: schema.backward-compatibility
content: '"ALTER TABLE tech_book MODIFY name TEXT" may cause incompatibility with the existing data and code'
line: 1
+ details: ""
- statement: ALTER TABLE tech_book MODIFY name TEXT NULL
want:
- status: WARN
@@ -19,6 +21,7 @@
title: schema.backward-compatibility
content: '"ALTER TABLE tech_book MODIFY name TEXT NULL" may cause incompatibility with the existing data and code'
line: 1
+ details: ""
- statement: ALTER TABLE tech_book MODIFY name TEXT NOT NULL
want:
- status: WARN
@@ -26,6 +29,7 @@
title: schema.backward-compatibility
content: '"ALTER TABLE tech_book MODIFY name TEXT NOT NULL" may cause incompatibility with the existing data and code'
line: 1
+ details: ""
- statement: ALTER TABLE tech_book MODIFY name TEXT COMMENT 'bla'
want:
- status: WARN
@@ -33,3 +37,4 @@
title: schema.backward-compatibility
content: '"ALTER TABLE tech_book MODIFY name TEXT COMMENT ''bla''" may cause incompatibility with the existing data and code'
line: 1
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/statement_affected_row_limit.yaml b/backend/plugin/advisor/mysql/test/statement_affected_row_limit.yaml
index a23ef20e45..58391995e6 100644
--- a/backend/plugin/advisor/mysql/test/statement_affected_row_limit.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_affected_row_limit.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: UPDATE tech_book SET id = 1
want:
- status: SUCCESS
@@ -12,3 +13,4 @@
title: OK
content: ""
line: 0
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/statement_disallow_commit.yaml b/backend/plugin/advisor/mysql/test/statement_disallow_commit.yaml
index 0293cbec31..fcf79a651d 100644
--- a/backend/plugin/advisor/mysql/test/statement_disallow_commit.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_disallow_commit.yaml
@@ -8,6 +8,7 @@
title: statement.disallow-commit
content: 'Commit is not allowed, related statement: "COMMIT;"'
line: 3
+ details: ""
- statement: |-
START TRANSACTION;
CREATE TABLE techBook(id int, name varchar(255));
@@ -22,8 +23,10 @@
title: statement.disallow-commit
content: 'Commit is not allowed, related statement: "COMMIT;"'
line: 3
+ details: ""
- status: WARN
code: 206
title: statement.disallow-commit
content: 'Commit is not allowed, related statement: "COMMIT;"'
line: 7
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/statement_disallow_limit.yaml b/backend/plugin/advisor/mysql/test/statement_disallow_limit.yaml
index a1832b402c..d136ed57ac 100644
--- a/backend/plugin/advisor/mysql/test/statement_disallow_limit.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_disallow_limit.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: INSERT INTO tech_book SELECT * FROM tech_book LIMIT 1
want:
- status: WARN
@@ -12,6 +13,7 @@
title: statement.disallow-limit
content: LIMIT clause is forbidden in INSERT, UPDATE and DELETE statement, but "INSERT INTO tech_book SELECT * FROM tech_book LIMIT 1" uses
line: 1
+ details: ""
- statement: INSERT INTO tech_book SELECT * FROM tech_book UNION SELECT * FROM tech_book LIMIT 1
want:
- status: WARN
@@ -19,6 +21,7 @@
title: statement.disallow-limit
content: LIMIT clause is forbidden in INSERT, UPDATE and DELETE statement, but "INSERT INTO tech_book SELECT * FROM tech_book UNION SELECT * FROM tech_book LIMIT 1" uses
line: 1
+ details: ""
- statement: UPDATE tech_book SET name = 'my name' LIMIT 10
want:
- status: WARN
@@ -26,6 +29,7 @@
title: statement.disallow-limit
content: LIMIT clause is forbidden in INSERT, UPDATE and DELETE statement, but "UPDATE tech_book SET name = 'my name' LIMIT 10" uses
line: 1
+ details: ""
- statement: DELETE FROM tech_book LIMIT 10
want:
- status: WARN
@@ -33,3 +37,4 @@
title: statement.disallow-limit
content: LIMIT clause is forbidden in INSERT, UPDATE and DELETE statement, but "DELETE FROM tech_book LIMIT 10" uses
line: 1
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/statement_disallow_order_by.yaml b/backend/plugin/advisor/mysql/test/statement_disallow_order_by.yaml
index c0cdd5020a..e9f45b9e6a 100644
--- a/backend/plugin/advisor/mysql/test/statement_disallow_order_by.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_disallow_order_by.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: UPDATE tech_book SET name = 'my name' ORDER BY id
want:
- status: WARN
@@ -12,6 +13,7 @@
title: statement.disallow-order-by
content: ORDER BY clause is forbidden in DELETE and UPDATE statements, but "UPDATE tech_book SET name = 'my name' ORDER BY id" uses
line: 1
+ details: ""
- statement: DELETE FROM tech_book ORDER BY id
want:
- status: WARN
@@ -19,3 +21,4 @@
title: statement.disallow-order-by
content: ORDER BY clause is forbidden in DELETE and UPDATE statements, but "DELETE FROM tech_book ORDER BY id" uses
line: 1
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/statement_dml_dry_run.yaml b/backend/plugin/advisor/mysql/test/statement_dml_dry_run.yaml
index df16988259..c9f492fe7a 100644
--- a/backend/plugin/advisor/mysql/test/statement_dml_dry_run.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_dml_dry_run.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: DELETE FROM tech_book
want:
- status: SUCCESS
@@ -12,3 +13,4 @@
title: OK
content: ""
line: 0
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/statement_insert_disallow_order_by_rand.yaml b/backend/plugin/advisor/mysql/test/statement_insert_disallow_order_by_rand.yaml
index 9b5896577a..79a825f657 100644
--- a/backend/plugin/advisor/mysql/test/statement_insert_disallow_order_by_rand.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_insert_disallow_order_by_rand.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: INSERT INTO tech_book SELECT * FROM tech_book ORDER BY rand()
want:
- status: WARN
@@ -12,3 +13,4 @@
title: statement.insert.disallow-order-by-rand
content: '"INSERT INTO tech_book SELECT * FROM tech_book ORDER BY rand()" uses ORDER BY RAND in the INSERT statement'
line: 1
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/statement_insert_must_specify_column.yaml b/backend/plugin/advisor/mysql/test/statement_insert_must_specify_column.yaml
index bcf13aec8f..ed3beaefcf 100644
--- a/backend/plugin/advisor/mysql/test/statement_insert_must_specify_column.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_insert_must_specify_column.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: INSERT INTO tech_book VALUES (1, '1')
want:
- status: WARN
@@ -12,3 +13,4 @@
title: statement.insert.must-specify-column
content: The INSERT statement must specify columns but "INSERT INTO tech_book VALUES (1, '1')" does not
line: 1
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/statement_insert_row_limit.yaml b/backend/plugin/advisor/mysql/test/statement_insert_row_limit.yaml
index a143330655..eadd625df6 100644
--- a/backend/plugin/advisor/mysql/test/statement_insert_row_limit.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_insert_row_limit.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: INSERT INTO tech_book values(1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e'), (6, 'f')
want:
- status: WARN
@@ -12,6 +13,7 @@
title: statement.insert.row-limit
content: '"INSERT INTO tech_book values(1, ''a''), (2, ''b''), (3, ''c''), (4, ''d''), (5, ''e''), (6, ''f'')" inserts 6 rows. The count exceeds 5.'
line: 1
+ details: ""
- statement: INSERT INTO tech_book SELECT * FROM tech_book
want:
- status: SUCCESS
@@ -19,3 +21,4 @@
title: OK
content: ""
line: 0
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/statement_merge_alter_table.yaml b/backend/plugin/advisor/mysql/test/statement_merge_alter_table.yaml
index d33f1bfc34..bd31e8960c 100644
--- a/backend/plugin/advisor/mysql/test/statement_merge_alter_table.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_merge_alter_table.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
ALTER TABLE tech_book ADD COLUMN a int;
ALTER TABLE tech_book ADD COLUMN b int;
@@ -14,6 +15,7 @@
title: statement.merge-alter-table
content: There are 2 statements to modify table `tech_book`
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE tech_book ADD COLUMN a int;
@@ -25,11 +27,13 @@
title: statement.merge-alter-table
content: There are 2 statements to modify table `t`
line: 3
+ details: ""
- status: WARN
code: 207
title: statement.merge-alter-table
content: There are 2 statements to modify table `tech_book`
line: 4
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE tech_book ADD COLUMN a int;
@@ -41,8 +45,10 @@
title: statement.merge-alter-table
content: There are 2 statements to modify table `tech_book`
line: 3
+ details: ""
- status: WARN
code: 207
title: statement.merge-alter-table
content: There are 2 statements to modify table `t`
line: 4
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/statement_select_no_select_all.yaml b/backend/plugin/advisor/mysql/test/statement_select_no_select_all.yaml
index 7e2c6f4a63..4f12df0613 100644
--- a/backend/plugin/advisor/mysql/test/statement_select_no_select_all.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_select_no_select_all.yaml
@@ -5,6 +5,7 @@
title: statement.select.no-select-all
content: '"SELECT * FROM t" uses SELECT all'
line: 1
+ details: ""
- statement: SELECT a, b FROM t
want:
- status: SUCCESS
@@ -12,6 +13,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: SELECT a, b FROM (SELECT * from t1 JOIN t2) t
want:
- status: WARN
@@ -19,3 +21,4 @@
title: statement.select.no-select-all
content: '"SELECT a, b FROM (SELECT * from t1 JOIN t2) t" uses SELECT all'
line: 1
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/statement_where_no_leading_wildcard_like.yaml b/backend/plugin/advisor/mysql/test/statement_where_no_leading_wildcard_like.yaml
index f4e3424b48..0765d6e4d9 100644
--- a/backend/plugin/advisor/mysql/test/statement_where_no_leading_wildcard_like.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_where_no_leading_wildcard_like.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: SELECT * FROM t WHERE a LIKE '%abc'
want:
- status: WARN
@@ -12,6 +13,7 @@
title: statement.where.no-leading-wildcard-like
content: '"SELECT * FROM t WHERE a LIKE ''%abc''" uses leading wildcard LIKE'
line: 1
+ details: ""
- statement: SELECT * FROM t WHERE a LIKE 'abc' OR a LIKE '%abc'
want:
- status: WARN
@@ -19,6 +21,7 @@
title: statement.where.no-leading-wildcard-like
content: '"SELECT * FROM t WHERE a LIKE ''abc'' OR a LIKE ''%abc''" uses leading wildcard LIKE'
line: 1
+ details: ""
- statement: SELECT * FROM t WHERE a LIKE '%acc' OR a LIKE '%abc'
want:
- status: WARN
@@ -26,6 +29,7 @@
title: statement.where.no-leading-wildcard-like
content: '"SELECT * FROM t WHERE a LIKE ''%acc'' OR a LIKE ''%abc''" uses leading wildcard LIKE'
line: 1
+ details: ""
- statement: SELECT * FROM (SELECT * FROM t WHERE a LIKE '%acc' OR a LIKE '%abc') t1
want:
- status: WARN
@@ -33,3 +37,4 @@
title: statement.where.no-leading-wildcard-like
content: '"SELECT * FROM (SELECT * FROM t WHERE a LIKE ''%acc'' OR a LIKE ''%abc'') t1" uses leading wildcard LIKE'
line: 1
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/statement_where_require.yaml b/backend/plugin/advisor/mysql/test/statement_where_require.yaml
index e4348c306c..af4064bd2c 100644
--- a/backend/plugin/advisor/mysql/test/statement_where_require.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_where_require.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: DELETE FROM tech_book
want:
- status: WARN
@@ -12,6 +13,7 @@
title: statement.where.require
content: '"DELETE FROM tech_book" requires WHERE clause'
line: 1
+ details: ""
- statement: UPDATE tech_book SET id = 1
want:
- status: WARN
@@ -19,6 +21,7 @@
title: statement.where.require
content: '"UPDATE tech_book SET id = 1" requires WHERE clause'
line: 1
+ details: ""
- statement: DELETE FROM tech_book WHERE id > 0
want:
- status: SUCCESS
@@ -26,6 +29,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: UPDATE tech_book SET id = 1 WHERE id > 10
want:
- status: SUCCESS
@@ -33,6 +37,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: SELECT id FROM tech_book
want:
- status: WARN
@@ -40,6 +45,7 @@
title: statement.where.require
content: '"SELECT id FROM tech_book" requires WHERE clause'
line: 1
+ details: ""
- statement: SELECT id FROM tech_book WHERE id > 0
want:
- status: SUCCESS
@@ -47,6 +53,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: SELECT id FROM tech_book WHERE id > (SELECT max(id) FROM tech_book)
want:
- status: WARN
@@ -54,3 +61,4 @@
title: statement.where.require
content: '"SELECT id FROM tech_book WHERE id > (SELECT max(id) FROM tech_book)" requires WHERE clause'
line: 1
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/system_charset_allowlist.yaml b/backend/plugin/advisor/mysql/test/system_charset_allowlist.yaml
index ef9e429aae..a2569b3553 100644
--- a/backend/plugin/advisor/mysql/test/system_charset_allowlist.yaml
+++ b/backend/plugin/advisor/mysql/test/system_charset_allowlist.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE t(a varchar(255))
want:
- status: SUCCESS
@@ -12,6 +13,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE t(a int) CHARSET ascii
want:
- status: WARN
@@ -19,6 +21,7 @@
title: system.charset.allowlist
content: '"CREATE TABLE t(a int) CHARSET ascii" used disabled charset ''ascii'''
line: 1
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t CHARSET ascii
@@ -28,6 +31,7 @@
title: system.charset.allowlist
content: '"ALTER TABLE t CHARSET ascii" used disabled charset ''ascii'''
line: 2
+ details: ""
- statement: ALTER DATABASE test CHARSET ascii
want:
- status: WARN
@@ -35,6 +39,7 @@
title: system.charset.allowlist
content: '"ALTER DATABASE test CHARSET ascii" used disabled charset ''ascii'''
line: 1
+ details: ""
- statement: CREATE TABLE t(a varchar(255) CHARSET ascii)
want:
- status: WARN
@@ -42,6 +47,7 @@
title: system.charset.allowlist
content: '"CREATE TABLE t(a varchar(255) CHARSET ascii)" used disabled charset ''ascii'''
line: 1
+ details: ""
- statement: |-
CREATE TABLE t(b int);
ALTER TABLE t ADD COLUMN a varchar(255) CHARSET ascii
@@ -51,6 +57,7 @@
title: system.charset.allowlist
content: '"ALTER TABLE t ADD COLUMN a varchar(255) CHARSET ascii" used disabled charset ''ascii'''
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t MODIFY COLUMN a varchar(255) CHARSET ascii
@@ -60,6 +67,7 @@
title: system.charset.allowlist
content: '"ALTER TABLE t MODIFY COLUMN a varchar(255) CHARSET ascii" used disabled charset ''ascii'''
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t CHANGE COLUMN a a varchar(255) CHARSET ascii
@@ -69,6 +77,7 @@
title: system.charset.allowlist
content: '"ALTER TABLE t CHANGE COLUMN a a varchar(255) CHARSET ascii" used disabled charset ''ascii'''
line: 2
+ details: ""
- statement: /* this is a comment */
want:
- status: SUCCESS
@@ -76,3 +85,4 @@
title: OK
content: ""
line: 0
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/system_collation_allowlist.yaml b/backend/plugin/advisor/mysql/test/system_collation_allowlist.yaml
index ce69200e64..bdc6be1159 100644
--- a/backend/plugin/advisor/mysql/test/system_collation_allowlist.yaml
+++ b/backend/plugin/advisor/mysql/test/system_collation_allowlist.yaml
@@ -5,6 +5,7 @@
title: system.collation.allowlist
content: '"CREATE TABLE t(a int) COLLATE utf8mb4_polish_ci" used disabled collation ''utf8mb4_polish_ci'''
line: 1
+ details: ""
- statement: CREATE TABLE t(a varchar(255))
want:
- status: SUCCESS
@@ -12,6 +13,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE t(a int) COLLATE latin1_bin
want:
- status: WARN
@@ -19,6 +21,7 @@
title: system.collation.allowlist
content: '"CREATE TABLE t(a int) COLLATE latin1_bin" used disabled collation ''latin1_bin'''
line: 1
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t COLLATE latin1_bin
@@ -28,6 +31,7 @@
title: system.collation.allowlist
content: '"ALTER TABLE t COLLATE latin1_bin" used disabled collation ''latin1_bin'''
line: 2
+ details: ""
- statement: ALTER DATABASE test COLLATE latin1_bin
want:
- status: WARN
@@ -35,6 +39,7 @@
title: system.collation.allowlist
content: '"ALTER DATABASE test COLLATE latin1_bin" used disabled collation ''latin1_bin'''
line: 1
+ details: ""
- statement: CREATE TABLE t(a varchar(255) CHARACTER SET latin1 COLLATE latin1_bin)
want:
- status: WARN
@@ -42,6 +47,7 @@
title: system.collation.allowlist
content: '"CREATE TABLE t(a varchar(255) CHARACTER SET latin1 COLLATE latin1_bin)" used disabled collation ''latin1_bin'''
line: 1
+ details: ""
- statement: |-
CREATE TABLE t(b int);
ALTER TABLE t ADD COLUMN a varchar(255) CHARACTER SET latin1 COLLATE latin1_bin
@@ -51,6 +57,7 @@
title: system.collation.allowlist
content: '"ALTER TABLE t ADD COLUMN a varchar(255) CHARACTER SET latin1 COLLATE latin1_bin" used disabled collation ''latin1_bin'''
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t MODIFY COLUMN a varchar(255) CHARACTER SET latin1 COLLATE latin1_bin
@@ -60,6 +67,7 @@
title: system.collation.allowlist
content: '"ALTER TABLE t MODIFY COLUMN a varchar(255) CHARACTER SET latin1 COLLATE latin1_bin" used disabled collation ''latin1_bin'''
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t CHANGE COLUMN a a varchar(255) CHARACTER SET latin1 COLLATE latin1_bin
@@ -69,3 +77,4 @@
title: system.collation.allowlist
content: '"ALTER TABLE t CHANGE COLUMN a a varchar(255) CHARACTER SET latin1 COLLATE latin1_bin" used disabled collation ''latin1_bin'''
line: 2
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/table_comment.yaml b/backend/plugin/advisor/mysql/test/table_comment.yaml
index 89aae589c4..e9f1263ebd 100644
--- a/backend/plugin/advisor/mysql/test/table_comment.yaml
+++ b/backend/plugin/advisor/mysql/test/table_comment.yaml
@@ -5,6 +5,7 @@
title: table.comment
content: The length of table `t` comment should be within 10 characters
line: 1
+ details: ""
- statement: CREATE TABLE t(a int)
want:
- status: WARN
@@ -12,6 +13,7 @@
title: table.comment
content: Table `t` requires comments
line: 1
+ details: ""
- statement: CREATE TABLE t(a int) COMMENT 'sdlfkjalkseblkjduafelbnlsdfkljayue'
want:
- status: WARN
@@ -19,3 +21,4 @@
title: table.comment
content: The length of table `t` comment should be within 10 characters
line: 1
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/table_disallow_partition.yaml b/backend/plugin/advisor/mysql/test/table_disallow_partition.yaml
index 6f3b7c019d..58fe721c39 100644
--- a/backend/plugin/advisor/mysql/test/table_disallow_partition.yaml
+++ b/backend/plugin/advisor/mysql/test/table_disallow_partition.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(a int) PARTITION BY RANGE (a) (
PARTITION p0 VALUES LESS THAN (6),
@@ -20,6 +21,7 @@
PARTITION p1 VALUES LESS THAN (11)
)" creates
line: 4
+ details: ""
- statement: |-
ALTER TABLE tech_book PARTITION BY RANGE (a) (
PARTITION p0 VALUES LESS THAN (6),
@@ -35,3 +37,4 @@
PARTITION p1 VALUES LESS THAN (11)
)" creates
line: 4
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/table_drop_naming_convention.yaml b/backend/plugin/advisor/mysql/test/table_drop_naming_convention.yaml
index 7143a405ab..a54ba29f54 100644
--- a/backend/plugin/advisor/mysql/test/table_drop_naming_convention.yaml
+++ b/backend/plugin/advisor/mysql/test/table_drop_naming_convention.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: DROP TABLE IF EXISTS foo
want:
- status: WARN
@@ -12,6 +13,7 @@
title: table.drop-naming-convention
content: '`foo` mismatches drop table naming convention, naming format should be "_delete$"'
line: 1
+ details: ""
- statement: DROP TABLE IF EXISTS foo_delete, bar
want:
- status: WARN
@@ -19,3 +21,4 @@
title: table.drop-naming-convention
content: '`bar` mismatches drop table naming convention, naming format should be "_delete$"'
line: 1
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/table_no_foreign_key.yaml b/backend/plugin/advisor/mysql/test/table_no_foreign_key.yaml
index 188ce1b7ce..a612f5c79d 100644
--- a/backend/plugin/advisor/mysql/test/table_no_foreign_key.yaml
+++ b/backend/plugin/advisor/mysql/test/table_no_foreign_key.yaml
@@ -5,6 +5,7 @@
title: table.no-foreign-key
content: Foreign key is not allowed in the table `tech_book`
line: 1
+ details: ""
- statement: CREATE TABLE book(id INT, author_id INT, FOREIGN KEY fk_book_author_id_author_id (author_id) REFERENCES author (id))
want:
- status: WARN
@@ -12,3 +13,4 @@
title: table.no-foreign-key
content: Foreign key is not allowed in the table `book`
line: 1
+ details: ""
diff --git a/backend/plugin/advisor/mysql/test/table_require_pk.yaml b/backend/plugin/advisor/mysql/test/table_require_pk.yaml
index 991ea6b016..edcd895663 100644
--- a/backend/plugin/advisor/mysql/test/table_require_pk.yaml
+++ b/backend/plugin/advisor/mysql/test/table_require_pk.yaml
@@ -5,6 +5,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE t(id INT, PRIMARY KEY (id))
want:
- status: SUCCESS
@@ -12,6 +13,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: CREATE TABLE t(id INT)
want:
- status: WARN
@@ -19,6 +21,7 @@
title: table.require-pk
content: Table `t` requires PRIMARY KEY
line: 1
+ details: ""
- statement: |-
CREATE TABLE t(id INT);
DROP TABLE t
@@ -28,6 +31,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(id INT);
ALTER TABLE t ADD CONSTRAINT PRIMARY KEY (id)
@@ -37,6 +41,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(id INT PRIMARY KEY);
ALTER TABLE t DROP PRIMARY KEY
@@ -46,6 +51,7 @@
title: table.require-pk
content: Table `t` requires PRIMARY KEY
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(id INT PRIMARY KEY);
ALTER TABLE t DROP INDEX `PRIMARY`
@@ -55,6 +61,7 @@
title: table.require-pk
content: Table `t` requires PRIMARY KEY
line: 2
+ details: ""
- statement: |-
CREATE TABLE t(id INT);
ALTER TABLE t ADD COLUMN name varchar(30) PRIMARY KEY
@@ -64,6 +71,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(id INT);
ALTER TABLE t CHANGE COLUMN id id INT PRIMARY KEY
@@ -73,6 +81,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: ALTER TABLE tech_book CHANGE COLUMN id uid INT
want:
- status: SUCCESS
@@ -80,6 +89,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(id INT);
ALTER TABLE t MODIFY COLUMN id INT PRIMARY KEY
@@ -89,6 +99,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: ALTER TABLE tech_book MODIFY COLUMN id INT
want:
- status: SUCCESS
@@ -96,6 +107,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(id INT, name varchar(30), PRIMARY KEY(id, name));
ALTER TABLE t DROP COLUMN id
@@ -105,6 +117,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
CREATE TABLE t(id INT, name varchar(30), comment varchar(255), PRIMARY KEY(id, name));
ALTER TABLE t DROP COLUMN id, DROP COLUMN name
@@ -114,6 +127,7 @@
title: table.require-pk
content: Table `t` requires PRIMARY KEY
line: 2
+ details: ""
- statement: ALTER TABLE tech_book ADD COLUMN a int, DROP COLUMN id, DROP COLUMN name
want:
- status: WARN
@@ -121,6 +135,7 @@
title: table.require-pk
content: Table `tech_book` requires PRIMARY KEY
line: 1
+ details: ""
- statement: ALTER TABLE tech_book DROP COLUMN name
want:
- status: SUCCESS
@@ -128,6 +143,7 @@
title: OK
content: ""
line: 0
+ details: ""
- statement: |-
ALTER TABLE tech_book CHANGE COLUMN id uid int;
ALTER TABLE tech_book ADD COLUMN a int, DROP COLUMN uid, DROP COLUMN name
@@ -137,3 +153,4 @@
title: table.require-pk
content: Table `tech_book` requires PRIMARY KEY
line: 2
+ details: ""