Skip to content

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

feat(parser): migrate MySQL core parsing to omni parser (#19812)

rebelice1a56474ea400
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 55d0c298a1..5ad47f0c8b 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
@@ -1,11 +1,8 @@
- statement: CREATE TABLE t(a int);
- changeType: 1
- statement: CREATE TABLE t(a int auto_increment) auto_increment = 20;
- changeType: 1
- statement: |-
CREATE TABLE t1(a int auto_increment) auto_increment = 20;
CREATE TABLE t2(a int auto_increment) auto_increment = 2;
- changeType: 1
want:
- status: 2
code: 416
@@ -20,7 +17,6 @@
ALTER TABLE t COMMENT 'table t';
ALTER TABLE t AUTO_INCREMENT = 20;
ALTER TABLE t AUTO_INCREMENT = 100;
- changeType: 1
want:
- status: 2
code: 416
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 0a1529949a..bd3e31258b 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
@@ -9,11 +9,9 @@
CREATE TABLE t8(a MEDIUMINT AUTO_INCREMENT);
CREATE TABLE t9(a bigint AUTO_INCREMENT);
CREATE TABLE t10(a BIGINT AUTO_INCREMENT);
- changeType: 1
- statement: |-
CREATE TABLE t1(a INT AUTO_INCREMENT);
CREATE TABLE t2(a varchar(255) AUTO_INCREMENT);
- changeType: 1
want:
- status: 2
code: 410
@@ -26,7 +24,6 @@
- statement: |-
CREATE TABLE t(b int);
ALTER TABLE t ADD COLUMN a varchar(255) AUTO_INCREMENT;
- changeType: 1
want:
- status: 2
code: 410
@@ -39,7 +36,6 @@
- statement: |-
CREATE TABLE t(b int);
ALTER TABLE t ADD COLUMN a varchar(255) AUTO_INCREMENT, ADD COLUMN c INT;
- changeType: 1
want:
- status: 2
code: 410
@@ -52,7 +48,6 @@
- statement: |-
CREATE TABLE t(b int);
ALTER TABLE t ADD COLUMN (a varchar(255) AUTO_INCREMENT, c INT);
- changeType: 1
want:
- status: 2
code: 410
@@ -66,7 +61,6 @@
CREATE TABLE t(a int, b int);
ALTER TABLE t MODIFY COLUMN a varchar(255) AUTO_INCREMENT;
ALTER TABLE t MODIFY COLUMN b varchar(255);
- changeType: 1
want:
- status: 2
code: 410
@@ -79,7 +73,6 @@
- statement: |-
CREATE TABLE t(b int);
ALTER TABLE t CHANGE COLUMN b a varchar(255) AUTO_INCREMENT;
- changeType: 1
want:
- status: 2
code: 410
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 e78665c141..fd98cb06d8 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
@@ -1,7 +1,5 @@
- statement: CREATE TABLE t(a INT UNSIGNED AUTO_INCREMENT);
- changeType: 1
- statement: CREATE TABLE t(a INT AUTO_INCREMENT);
- changeType: 1
want:
- status: 2
code: 417
@@ -12,7 +10,6 @@
column: 0
endposition: null
- statement: CREATE TABLE t(a INT SIGNED AUTO_INCREMENT);
- changeType: 1
want:
- status: 2
code: 417
@@ -23,11 +20,9 @@
column: 0
endposition: null
- statement: CREATE TABLE t(a INT ZEROFILL AUTO_INCREMENT);
- changeType: 1
- statement: |-
CREATE TABLE t(b int);
ALTER TABLE t ADD COLUMN a INT AUTO_INCREMENT, ADD COLUMN c INT ZEROFILL AUTO_INCREMENT, ADD COLUMN d INT UNSIGNED AUTO_INCREMENT;
- changeType: 1
want:
- status: 2
code: 417
@@ -41,7 +36,6 @@
CREATE TABLE t(a int, b int);
ALTER TABLE t MODIFY COLUMN a INT AUTO_INCREMENT;
ALTER TABLE t MODIFY COLUMN a INT UNSIGNED AUTO_INCREMENT;
- changeType: 1
want:
- status: 2
code: 417
@@ -55,7 +49,6 @@
CREATE TABLE t(b int);
ALTER TABLE t CHANGE COLUMN b a INT AUTO_INCREMENT;
ALTER TABLE t CHANGE COLUMN a c INT UNSIGNED AUTO_INCREMENT;
- changeType: 1
want:
- status: 2
code: 417
diff --git a/backend/plugin/advisor/mysql/test/column_comment.yaml b/backend/plugin/advisor/mysql/test/column_comment.yaml
index 724a347e10..e3455ef4be 100644
--- a/backend/plugin/advisor/mysql/test/column_comment.yaml
+++ b/backend/plugin/advisor/mysql/test/column_comment.yaml
@@ -11,7 +11,6 @@
UNIQUE KEY uk1(id, name),
FOREIGN KEY fk1(roomId) REFERENCES room(id),
INDEX idx_userTable_content(content)) ENGINE = CSV COLLATE latin1_bin;
- changeType: 1
want:
- status: 2
code: 1032
@@ -49,16 +48,13 @@
INDEX idx_user_name(name),
UNIQUE KEY uk_user_id_name(id, name)
) ENGINE = INNODB COMMENT 'comment';
- changeType: 1
- statement: CREATE TABLE t(a int COMMENT 'comments');
- changeType: 1
- statement: |-
CREATE TABLE t(
a int COMMENT 'some comments',
b int,
c int
);
- changeType: 1
want:
- status: 2
code: 1301
@@ -87,7 +83,6 @@
- statement: |-
CREATE TABLE t(a int COMMENT 'comment');
ALTER TABLE t ADD COLUMN b int;
- changeType: 1
want:
- status: 2
code: 1032
@@ -100,7 +95,6 @@
- statement: |-
CREATE TABLE t(a int COMMENT 'comment');
ALTER TABLE t ADD COLUMN (b int, c int);
- changeType: 1
want:
- status: 2
code: 1032
@@ -121,7 +115,6 @@
- statement: |-
CREATE TABLE t(a int COMMENT 'this is comment');
ALTER TABLE t CHANGE COLUMN a b int;
- changeType: 1
want:
- status: 2
code: 1301
@@ -142,7 +135,6 @@
- statement: |-
CREATE TABLE t(b int COMMENT 'It is comment');
ALTER TABLE t MODIFY COLUMN b int;
- changeType: 1
want:
- status: 2
code: 1301
@@ -163,7 +155,6 @@
- statement: |-
CREATE TABLE t(b int COMMENT 'It is COMMENT');
ALTER TABLE t MODIFY COLUMN b int COMMENT 'abcdefghiakljhakljdsfalugelkhnabsdguelkadf';
- changeType: 1
want:
- status: 2
code: 1301
@@ -181,7 +172,6 @@
line: 2
column: 0
endposition: null
-# Test cases for virtual/generated columns (BYT-8503)
- statement: |-
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY COMMENT 'ID',
@@ -189,28 +179,21 @@
last_name VARCHAR(60) NOT NULL COMMENT 'Last',
full_name VARCHAR(120) GENERATED ALWAYS AS (CONCAT(first_name, ' ', last_name)) VIRTUAL COMMENT 'Full'
);
- changeType: 1
-# Virtual column with comment - should pass
- statement: |-
CREATE TABLE t(
a int COMMENT 'comment',
b int GENERATED ALWAYS AS (a * 2) VIRTUAL COMMENT 'comment'
);
- changeType: 1
-# Stored generated column with comment - should pass
- statement: |-
CREATE TABLE t(
a int COMMENT 'comment',
b int GENERATED ALWAYS AS (a * 2) STORED COMMENT 'comment'
);
- changeType: 1
-# Virtual column without comment - should fail
- statement: |-
CREATE TABLE t(
a int COMMENT 'comment',
b int GENERATED ALWAYS AS (a * 2) VIRTUAL
);
- changeType: 1
want:
- status: 2
code: 1032
@@ -220,13 +203,11 @@
line: 3
column: 0
endposition: null
-# Mixed regular and generated columns
- statement: |-
CREATE TABLE t(
a int,
b int GENERATED ALWAYS AS (a * 2) VIRTUAL
);
- changeType: 1
want:
- status: 2
code: 1032
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 4900f2f689..7a305fd4bf 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
@@ -11,7 +11,6 @@
UNIQUE KEY uk1(id, name),
FOREIGN KEY fk1(roomId) REFERENCES room(id),
INDEX idx_userTable_content(content)) ENGINE = CSV COLLATE latin1_bin;
- changeType: 1
want:
- status: 2
code: 419
@@ -33,16 +32,13 @@
INDEX idx_user_name(name),
UNIQUE KEY uk_user_id_name(id, name)
) ENGINE = INNODB COMMENT 'comment';
- changeType: 1
- statement: CREATE TABLE t(a timestamp, b timestamp)
- changeType: 1
- statement: |-
CREATE TABLE t(
a timestamp default now(),
b timestamp default current_timestamp(),
c timestamp default localtime
);
- changeType: 1
want:
- status: 2
code: 418
@@ -57,7 +53,6 @@
a timestamp default now() on update localtime,
b timestamp default current_timestamp() on update localtimestamp()
);
- changeType: 1
want:
- status: 2
code: 419
@@ -70,7 +65,6 @@
- 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();
- changeType: 1
want:
- status: 2
code: 419
diff --git a/backend/plugin/advisor/mysql/test/column_disallow_change.yaml b/backend/plugin/advisor/mysql/test/column_disallow_change.yaml
index badb2d720e..260d315cbd 100644
--- a/backend/plugin/advisor/mysql/test/column_disallow_change.yaml
+++ b/backend/plugin/advisor/mysql/test/column_disallow_change.yaml
@@ -1,11 +1,9 @@
- statement: |-
CREATE TABLE t(b int);
ALTER TABLE t ADD COLUMN a int;
- changeType: 1
- statement: |-
CREATE TABLE t(b int);
ALTER TABLE t CHANGE COLUMN b a int;
- changeType: 1
want:
- status: 2
code: 406
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 57e5d12ec0..f5b629e313 100644
--- a/backend/plugin/advisor/mysql/test/column_disallow_change_type.yaml
+++ b/backend/plugin/advisor/mysql/test/column_disallow_change_type.yaml
@@ -3,7 +3,6 @@
ALTER TABLE tech_book MODIFY id INT;
ALTER TABLE tech_book MODIFY id INTEGER;
ALTER TABLE tech_book MODIFY id INTEGER UNSIGNED;
- changeType: 1
want:
- status: 2
code: 403
@@ -24,7 +23,6 @@
- statement: |-
ALTER TABLE tech_book MODIFY id int;
ALTER TABLE tech_book MODIFY id int(4);
- changeType: 1
want:
- status: 2
code: 403
@@ -37,7 +35,6 @@
- statement: |-
ALTER TABLE tech_book MODIFY id bigint;
ALTER TABLE tech_book MODIFY id smallint;
- changeType: 1
want:
- status: 2
code: 403
@@ -56,7 +53,6 @@
column: 0
endposition: null
- statement: ALTER TABLE tech_book CHANGE name uname varchar(20);
- changeType: 1
want:
- status: 2
code: 403
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 15b30eb146..00da817b2d 100644
--- a/backend/plugin/advisor/mysql/test/column_disallow_changing_order.yaml
+++ b/backend/plugin/advisor/mysql/test/column_disallow_changing_order.yaml
@@ -1,11 +1,9 @@
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t MODIFY COLUMN a int;
- changeType: 1
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t MODIFY COLUMN a int FIRST;
- changeType: 1
want:
- status: 2
code: 407
@@ -18,7 +16,6 @@
- statement: |-
CREATE TABLE t(b int, a1 int);
ALTER TABLE t CHANGE COLUMN a1 a int FIRST;
- changeType: 1
want:
- status: 2
code: 407
@@ -31,7 +28,6 @@
- statement: |-
CREATE TABLE t(a int, b int);
ALTER TABLE t MODIFY COLUMN a int AFTER b;
- changeType: 1
want:
- status: 2
code: 407
@@ -44,7 +40,6 @@
- statement: |-
CREATE TABLE t(a1 int, b int);
ALTER TABLE t CHANGE COLUMN a1 a int AFTER b;
- changeType: 1
want:
- status: 2
code: 407
diff --git a/backend/plugin/advisor/mysql/test/column_disallow_drop_in_index.yaml b/backend/plugin/advisor/mysql/test/column_disallow_drop_in_index.yaml
index f8ad764e08..140f091c3b 100644
--- a/backend/plugin/advisor/mysql/test/column_disallow_drop_in_index.yaml
+++ b/backend/plugin/advisor/mysql/test/column_disallow_drop_in_index.yaml
@@ -11,7 +11,6 @@
UNIQUE KEY uk1(id, name),
FOREIGN KEY fk1(roomId) REFERENCES room(id),
INDEX idx_userTable_content(content)) ENGINE = CSV COLLATE latin1_bin;
- changeType: 1
- statement: |
CREATE TABLE user(
id INT PRIMARY KEY COMMENT 'comment',
@@ -24,15 +23,12 @@
INDEX idx_user_name(name),
UNIQUE KEY uk_user_id_name(id, name)
) ENGINE = INNODB COMMENT 'comment';
- changeType: 1
- statement: |-
CREATE TABLE t(a int, b int, INDEX idx_a(a));
ALTER TABLE t DROP COLUMN b;
- changeType: 1
- statement: |-
CREATE TABLE t(a int, b int, INDEX idx_b(b));
ALTER TABLE t DROP COLUMN b;
- changeType: 1
want:
- status: 2
code: 424
@@ -45,7 +41,6 @@
- statement: |-
CREATE TABLE t(a int, c int, INDEX idx_ac(a,c));
ALTER TABLE t DROP COLUMN c;
- changeType: 1
want:
- status: 2
code: 424
@@ -59,12 +54,10 @@
CREATE TABLE t(a int, b int, INDEX idx_a(a));
CREATE TABLE y(a int, b int);
ALTER TABLE y DROP COLUMN a;
- changeType: 1
- statement: |-
CREATE TABLE t(a int,b int, c int, INDEX idx_ac(a,c));
ALTER TABLE t DROP COLUMN a;
ALTER TABLE t DROP COLUMN c;
- changeType: 1
want:
- status: 2
code: 424
@@ -81,4 +74,4 @@
startposition:
line: 3
column: 0
- endposition: null
\ No newline at end of file
+ endposition: null
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 f433112dcc..0a3128f32f 100644
--- a/backend/plugin/advisor/mysql/test/column_disallow_set_charset.yaml
+++ b/backend/plugin/advisor/mysql/test/column_disallow_set_charset.yaml
@@ -1,13 +1,10 @@
- statement: |-
CREATE TABLE dt_relation_temp(objto int);
ALTER TABLE dt_relation_temp ADD COLUMN infos json null comment'关系信息点'AFTER`objto`;
- changeType: 1
- statement: CREATE TABLE t(a varchar(20));
- changeType: 1
- statement: |-
CREATE TABLE t1(a varchar(20) CHARSET ascii);
CREATE TABLE t2(a varchar(20) CHARSET ascii);
- changeType: 1
want:
- status: 2
code: 414
@@ -28,7 +25,6 @@
- statement: |-
ALTER TABLE tech_book ADD COLUMN a varchar(20);
ALTER TABLE tech_book ADD COLUMN b varchar(20) CHARSET ascii;
- changeType: 1
want:
- status: 2
code: 414
@@ -42,7 +38,6 @@
ALTER TABLE tech_book ADD COLUMN a varchar(20), ADD COLUMN b varchar(20);
ALTER TABLE tech_book ADD COLUMN (c varchar(20) CHARSET ascii, d varchar(20) CHARSET ascii);
ALTER TABLE tech_book ADD COLUMN e varchar(20) CHARSET ascii;
- changeType: 1
want:
- status: 2
code: 414
@@ -71,7 +66,6 @@
- statement: |-
ALTER TABLE tech_book MODIFY COLUMN id int;
ALTER TABLE tech_book MODIFY COLUMN id varchar(20) CHARSET ascii;
- changeType: 1
want:
- status: 2
code: 414
@@ -84,7 +78,6 @@
- statement: |-
ALTER TABLE tech_book CHANGE COLUMN name name int;
ALTER TABLE tech_book CHANGE COLUMN name name varchar(20) CHARSET ascii;
- changeType: 1
want:
- status: 2
code: 414
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 5242242dc5..e087779496 100644
--- a/backend/plugin/advisor/mysql/test/column_maximum_character_length.yaml
+++ b/backend/plugin/advisor/mysql/test/column_maximum_character_length.yaml
@@ -1,13 +1,9 @@
- statement: CREATE TABLE t1(name char);
- changeType: 1
- statement: CREATE TABLE t(name char(20));
- changeType: 1
- statement: CREATE TABLE t(name varchar(225));
- changeType: 1
- statement: |-
CREATE TABLE t1(name char(20));
CREATE TABLE t2(name char(225));
- changeType: 1
want:
- status: 2
code: 415
@@ -20,7 +16,6 @@
- statement: |-
ALTER TABLE tech_book ADD COLUMN name_1 char(20);
ALTER TABLE tech_book ADD COLUMN name_2 char(225);
- changeType: 1
want:
- status: 2
code: 415
@@ -33,7 +28,6 @@
- statement: |-
ALTER TABLE tech_book CHANGE COLUMN name name char(20);
ALTER TABLE tech_book CHANGE COLUMN name name char(225);
- changeType: 1
want:
- status: 2
code: 415
@@ -46,7 +40,6 @@
- statement: |-
ALTER TABLE tech_book MODIFY COLUMN name char(20);
ALTER TABLE tech_book MODIFY COLUMN name char(225);
- changeType: 1
want:
- status: 2
code: 415
diff --git a/backend/plugin/advisor/mysql/test/column_maximum_varchar_length.yaml b/backend/plugin/advisor/mysql/test/column_maximum_varchar_length.yaml
index 1372cbf370..6946f51838 100644
--- a/backend/plugin/advisor/mysql/test/column_maximum_varchar_length.yaml
+++ b/backend/plugin/advisor/mysql/test/column_maximum_varchar_length.yaml
@@ -1,7 +1,5 @@
- statement: CREATE TABLE t(name varchar(225));
- changeType: 1
- statement: CREATE TABLE t1(name varchar(3000));
- changeType: 1
want:
- status: 2
code: 422
@@ -14,7 +12,6 @@
- statement: |-
ALTER TABLE tech_book ADD COLUMN name_1 char(20);
ALTER TABLE tech_book ADD COLUMN name_2 varchar(3000);
- changeType: 1
want:
- status: 2
code: 422
diff --git a/backend/plugin/advisor/mysql/test/column_no_null.yaml b/backend/plugin/advisor/mysql/test/column_no_null.yaml
index dba3adcc65..f8b88bf310 100644
--- a/backend/plugin/advisor/mysql/test/column_no_null.yaml
+++ b/backend/plugin/advisor/mysql/test/column_no_null.yaml
@@ -3,7 +3,6 @@
id int,
name varchar(255)
);
- changeType: 1
want:
- status: 2
code: 402
@@ -22,7 +21,6 @@
column: 0
endposition: null
- statement: CREATE TABLE book(id int PRIMARY KEY, name varchar(255));
- changeType: 1
want:
- status: 2
code: 402
@@ -33,7 +31,6 @@
column: 0
endposition: null
- statement: CREATE TABLE book(id int NOT NULL, name varchar(255));
- changeType: 1
want:
- status: 2
code: 402
@@ -44,11 +41,9 @@
column: 0
endposition: null
- statement: CREATE TABLE book(id int PRIMARY KEY, name varchar(255) NOT NULL);
- changeType: 1
- statement: |-
CREATE TABLE book(a int NOT NULL);
ALTER TABLE book ADD COLUMN (id int, name varchar(255) NOT NULL);
- changeType: 1
want:
- status: 2
code: 402
@@ -61,7 +56,6 @@
- statement: |-
CREATE TABLE book(a int NOT NULL);
ALTER TABLE book ADD COLUMN id int, ADD COLUMN name varchar(255) NOT NULL;
- changeType: 1
want:
- status: 2
code: 402
@@ -74,15 +68,12 @@
- statement: |-
CREATE TABLE book(a int NOT NULL);
ALTER TABLE book ADD COLUMN (id int PRIMARY KEY, name varchar(255) NOT NULL);
- changeType: 1
- statement: |-
CREATE TABLE book(a int NOT NULL);
ALTER TABLE book ADD COLUMN id int PRIMARY KEY, ADD COLUMN name varchar(255) NOT NULL;
- changeType: 1
- statement: |-
CREATE TABLE book(id int NOT NULL);
ALTER TABLE book CHANGE COLUMN id name varchar(255);
- changeType: 1
want:
- status: 2
code: 402
@@ -95,4 +86,3 @@
- statement: |-
CREATE TABLE book(id int NOT NULL);
ALTER TABLE book CHANGE COLUMN id name varchar(255) NOT NULL;
- changeType: 1
diff --git a/backend/plugin/advisor/mysql/test/column_require_default.yaml b/backend/plugin/advisor/mysql/test/column_require_default.yaml
index 4d5d57bfee..22eae3c651 100644
--- a/backend/plugin/advisor/mysql/test/column_require_default.yaml
+++ b/backend/plugin/advisor/mysql/test/column_require_default.yaml
@@ -4,7 +4,6 @@
b varchar(50) not null unique,
primary key (a)
);
- changeType: 1
want:
- status: 2
code: 420
@@ -23,7 +22,6 @@
e json,
f geometry
);
- changeType: 1
- statement: |-
CREATE TABLE t(
a geometry,
@@ -35,7 +33,6 @@
g multipolygon,
h geometrycollection
);
- changeType: 1
- statement: |-
CREATE TABLE t1(
a int primary key
@@ -43,13 +40,11 @@
CREATE TABLE t2(
a int auto_increment primary key
);
- changeType: 1
- statement: |-
CREATE TABLE t(
a int,
b int default 1
)
- changeType: 1
want:
- status: 2
code: 420
@@ -63,7 +58,6 @@
ALTER TABLE tech_book ADD COLUMN a BLOB;
ALTER TABLE tech_book ADD COLUMN b timestamp;
ALTER TABLE tech_book MODIFY COLUMN a varchar(220);
- changeType: 1
want:
- status: 2
code: 420
@@ -82,7 +76,6 @@
column: 0
endposition: null
- statement: ALTER TABLE tech_book ADD COLUMN (a BLOB, b timestamp);
- changeType: 1
want:
- status: 2
code: 420
@@ -96,7 +89,6 @@
ALTER TABLE tech_book ADD COLUMN a VARCHAR(255) DEFAULT 'default value';
ALTER TABLE tech_book MODIFY COLUMN a char(25) DEFAULT 'default';
ALTER TABLE tech_book CHANGE COLUMN a b int;
- changeType: 1
want:
- status: 2
code: 420
@@ -111,4 +103,3 @@
id int,
PRIMARY KEY (id)
)
- changeType: 1
diff --git a/backend/plugin/advisor/mysql/test/column_required.yaml b/backend/plugin/advisor/mysql/test/column_required.yaml
index be09b8c9ed..358bdb28af 100644
--- a/backend/plugin/advisor/mysql/test/column_required.yaml
+++ b/backend/plugin/advisor/mysql/test/column_required.yaml
@@ -5,7 +5,6 @@
CREATE TABLE t3(id INT, creator_id INT, created_ts timestamp);
CREATE TABLE t4(id INT, creator_id INT, created_ts timestamp, updater_id INT);
CREATE TABLE t5(id INT, creator_id INT, created_ts timestamp, updater_id INT, updated_ts timestamp);
- changeType: 1
want:
- status: 2
code: 401
@@ -55,7 +54,6 @@
updater_id int,
updated_ts timestamp
);
- changeType: 1
- statement: |-
CREATE TABLE book(
id int,
@@ -65,7 +63,6 @@
updated_ts timestamp
);
ALTER TABLE book RENAME COLUMN creator_id TO creator;
- changeType: 1
want:
- status: 2
code: 401
@@ -84,7 +81,6 @@
updated_ts timestamp
);
ALTER TABLE book RENAME COLUMN creator TO creator_id;
- changeType: 1
- statement: |-
CREATE TABLE book(
id int,
@@ -94,7 +90,6 @@
updated_ts timestamp
);
ALTER TABLE book CHANGE COLUMN creator_id creator int;
- changeType: 1
want:
- status: 2
code: 401
@@ -113,7 +108,6 @@
updated_ts timestamp
);
ALTER TABLE book CHANGE COLUMN creator creator_id int;
- changeType: 1
- statement: |-
CREATE TABLE book(
id int,
@@ -123,7 +117,6 @@
updated_ts timestamp
);
ALTER TABLE book DROP COLUMN creator_id;
- changeType: 1
want:
- status: 2
code: 401
@@ -143,7 +136,6 @@
content varchar(255)
);
ALTER TABLE book DROP COLUMN content;
- changeType: 1
- statement: |-
CREATE TABLE book(
id int,
@@ -152,7 +144,6 @@
updated_ts timestamp
);
ALTER TABLE book ADD COLUMN content varchar(255);
- changeType: 1
want:
- status: 2
code: 401
@@ -171,7 +162,6 @@
updated_ts timestamp
);
ALTER TABLE book ADD COLUMN creator_id int;
- changeType: 1
- statement: |-
CREATE TABLE book(
id int,
@@ -184,7 +174,6 @@
created_ts timestamp,
updated_ts timestamp
);
- changeType: 1
want:
- status: 2
code: 401
@@ -211,7 +200,6 @@
updated_ts timestamp
);
DROP TABLE book;
- changeType: 1
- statement: |-
CREATE TABLE book(
id int
@@ -222,4 +210,3 @@
updater_id int,
updated_ts timestamp
);
- changeType: 1
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 d27532d993..a29bf44653 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
@@ -2,17 +2,14 @@
CREATE TABLE book(
id int PRIMARY KEY DEFAULT 0
);
- changeType: 1
- statement: |-
CREATE TABLE book(
id int PRIMARY KEY
);
- changeType: 1
- statement: |-
CREATE TABLE book(
id int NOT NULL
);
- changeType: 1
want:
- status: 2
code: 404
@@ -27,15 +24,12 @@
id int,
PRIMARY KEY (id)
);
- changeType: 1
- statement: |-
CREATE TABLE book(a int);
ALTER TABLE book ADD COLUMN id int PRIMARY KEY;
- changeType: 1
- statement: |-
CREATE TABLE book(a int);
ALTER TABLE book ADD COLUMN id int NOT NULL;
- changeType: 1
want:
- status: 2
code: 404
@@ -48,7 +42,6 @@
- statement: |-
CREATE TABLE book(a int);
ALTER TABLE book ADD COLUMN (b int NOT NULL, c int NOT NULL);
- changeType: 1
want:
- status: 2
code: 404
@@ -69,7 +62,6 @@
- statement: |-
CREATE TABLE book(id int);
ALTER TABLE book MODIFY COLUMN id int NOT NULL;
- changeType: 1
want:
- status: 2
code: 404
@@ -82,15 +74,12 @@
- statement: |-
CREATE TABLE book(id int);
ALTER TABLE book MODIFY COLUMN id int PRIMARY KEY;
- changeType: 1
- statement: |-
CREATE TABLE book(uid int);
ALTER TABLE book CHANGE COLUMN uid id int PRIMARY KEY;
- changeType: 1
- statement: |-
CREATE TABLE book(uid int);
ALTER TABLE book CHANGE COLUMN uid id int NOT NULL;
- changeType: 1
want:
- status: 2
code: 404
@@ -103,7 +92,6 @@
- statement: |-
CREATE TABLE book(uid int, id int);
ALTER TABLE book CHANGE COLUMN uid uid int NOT NULL DEFAULT 0, MODIFY COLUMN id int PRIMARY KEY DEFAULT 0, ADD COLUMN name varchar(20) NOT NULL DEFAULT '';
- changeType: 1
- statement: |-
create table all_types(
c1 tinyblob not null,
@@ -119,4 +107,3 @@
c11 long varbinary not null,
c12 long varchar not null
);
- changeType: 1
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 5e29c8b28f..bdea97107d 100644
--- a/backend/plugin/advisor/mysql/test/column_type_disallow_list.yaml
+++ b/backend/plugin/advisor/mysql/test/column_type_disallow_list.yaml
@@ -1,7 +1,5 @@
- statement: CREATE TABLE t(a int);
- changeType: 1
- statement: CREATE TABLE t(a JSON, b BLOB, c TEXT);
- changeType: 1
want:
- status: 2
code: 411
@@ -14,7 +12,6 @@
- statement: |-
CREATE TABLE t(d int);
ALTER TABLE t add COLUMN (a JSON, b BLOB, c TEXT);
- changeType: 1
want:
- status: 2
code: 411
@@ -27,7 +24,6 @@
- statement: |-
CREATE TABLE t(d int);
ALTER TABLE t ADD COLUMN (a JSON, b JSON);
- changeType: 1
want:
- status: 2
code: 411
@@ -48,7 +44,6 @@
- statement: |-
CREATE TABLE t(c int, b int);
ALTER TABLE t CHANGE COLUMN c a JSON, MODIFY b BLOB;
- changeType: 1
want:
- status: 2
code: 411
@@ -61,7 +56,6 @@
- statement: |-
CREATE TABLE t(c int, b int);
ALTER TABLE t MODIFY COLUMN c JSON;
- changeType: 1
want:
- status: 2
code: 411
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 1ef5f0452d..e3258b1e3e 100644
--- a/backend/plugin/advisor/mysql/test/database_drop_empty_database.yaml
+++ b/backend/plugin/advisor/mysql/test/database_drop_empty_database.yaml
@@ -1,5 +1,4 @@
- statement: DROP DATABASE IF EXISTS test;
- changeType: 1
want:
- status: 2
code: 701
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 ef6be943df..be610837e2 100644
--- a/backend/plugin/advisor/mysql/test/engine_mysql_use_innodb.yaml
+++ b/backend/plugin/advisor/mysql/test/engine_mysql_use_innodb.yaml
@@ -11,7 +11,6 @@
UNIQUE KEY uk1(id, name),
FOREIGN KEY fk1(roomId) REFERENCES room(id),
INDEX idx_userTable_content(content)) ENGINE = CSV COLLATE latin1_bin;
- changeType: 1
want:
- status: 2
code: 501
@@ -45,17 +44,13 @@
INDEX idx_user_name(name),
UNIQUE KEY uk_user_id_name(id, name)
) ENGINE = INNODB COMMENT 'comment';
- changeType: 1
- statement: CREATE TABLE book(id int) ENGINE = INNODB;
- changeType: 1
- statement: CREATE TABLE book(id int);
- changeType: 1
- statement: |
CREATE TABLE book(
id INT,
price INT
) ENGINE = CSV;
- changeType: 1
want:
- status: 2
code: 501
@@ -75,7 +70,6 @@
id INT,
price INT
) ENGINE = CSV;
- changeType: 1
want:
- status: 2
code: 501
@@ -90,12 +84,10 @@
column: 0
endposition: null
- statement: ALTER TABLE tech_book ENGINE = INNODB;
- changeType: 1
- statement: |
CREATE TABLE teck_book(a INT);
CREATE TABLE book(a INT);
ALTER TABLE tech_book ENGINE = CSV;
- changeType: 1
want:
- status: 2
code: 501
@@ -106,11 +98,9 @@
column: 0
endposition: null
- statement: SET default_storage_engine=INNODB;
- changeType: 1
- statement: |
CREATE TABLE book(a INT);
SET default_storage_engine=CSV;
- changeType: 1
want:
- status: 2
code: 501
@@ -122,4 +112,3 @@
endposition: null
- statement: |
SET foreign_key_checks=0;
- changeType: 1
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 1747f7951b..e47a751810 100644
--- a/backend/plugin/advisor/mysql/test/index_key_number_limit.yaml
+++ b/backend/plugin/advisor/mysql/test/index_key_number_limit.yaml
@@ -1,5 +1,4 @@
- statement: CREATE TABLE t(a int, b int, primary key (a, b));
- changeType: 1
- statement: |-
CREATE TABLE t(
a int,
@@ -8,7 +7,6 @@
unique key uk (a, b, b, b, b, b, b),
foreign key fk (a, b, b, b, b, b) references t1(a, b, b, b, b, b)
);
- changeType: 1
want:
- status: 2
code: 802
@@ -38,7 +36,6 @@
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);
CREATE UNIQUE INDEX uk ON t(a, b, c, d, e, f, g);
- changeType: 1
want:
- status: 2
code: 802
@@ -60,7 +57,6 @@
CREATE TABLE t(a int, b int, c int, d int, e int, f int, g int);
ALTER TABLE t ADD PRIMARY KEY pk (a, b, c, d, e, f, g);
ALTER TABLE t ADD UNIQUE KEY uk (a, b, c, d, e, f, g);
- changeType: 1
want:
- status: 2
code: 802
@@ -81,7 +77,6 @@
- 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)
- changeType: 1
want:
- status: 2
code: 802
@@ -94,4 +89,3 @@
- statement: |-
CREATE TABLE t(a int, b varchar(255));
CREATE FULLTEXT INDEX idx ON t(b, b, b, b, b, b);
- changeType: 1
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 b1c50cbf85..46a9a237fa 100644
--- a/backend/plugin/advisor/mysql/test/index_no_duplicate_column.yaml
+++ b/backend/plugin/advisor/mysql/test/index_no_duplicate_column.yaml
@@ -1,11 +1,9 @@
- statement: CREATE TABLE t (a int, PRIMARY KEY (a));
- changeType: 1
- statement: |-
CREATE TABLE t (
a int,
PRIMARY KEY (a, a)
);
- changeType: 1
want:
- status: 2
code: 812
@@ -28,7 +26,6 @@
a int,
FOREIGN KEY fk1 (a, a) REFERENCES t1(a, a)
);
- changeType: 1
want:
- status: 2
code: 812
@@ -43,7 +40,6 @@
a int,
INDEX idx_a (a, a)
);
- changeType: 1
want:
- status: 2
code: 812
@@ -57,7 +53,6 @@
CREATE TABLE t(a int);
CREATE INDEX idx ON t(a);
CREATE INDEX idx_a ON t(a, a);
- changeType: 1
want:
- status: 2
code: 812
@@ -71,7 +66,6 @@
CREATE TABLE t(a int);
CREATE UNIQUE INDEX idx ON t(a);
CREATE UNIQUE INDEX idx_a ON t(a, a);
- changeType: 1
want:
- status: 2
code: 812
@@ -85,7 +79,6 @@
CREATE TABLE t(a int);
ALTER TABLE t ADD INDEX idx (a);
ALTER TABLE t ADD INDEX idx_a (a, a);
- changeType: 1
want:
- status: 2
code: 812
@@ -98,7 +91,6 @@
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD PRIMARY KEY pk_a (a, a);
- changeType: 1
want:
- status: 2
code: 812
@@ -111,12 +103,10 @@
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD PRIMARY KEY pk_a (a);
- changeType: 1
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD UNIQUE KEY uk (a);
ALTER TABLE t ADD UNIQUE KEY uk_a (a, a);
- changeType: 1
want:
- status: 2
code: 812
@@ -130,7 +120,6 @@
CREATE TABLE t(a int);
ALTER TABLE t ADD FOREIGN KEY fk (a) REFERENCES t1(a);
ALTER TABLE t ADD FOREIGN KEY fk_a (a, a) REFERENCES t1(a, b);
- changeType: 1
want:
- status: 2
code: 812
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 de01aefdcc..9c57a453fd 100644
--- a/backend/plugin/advisor/mysql/test/index_pk_type_limit.yaml
+++ b/backend/plugin/advisor/mysql/test/index_pk_type_limit.yaml
@@ -1,5 +1,4 @@
- statement: CREATE TABLE t(id VARCHAR(5) PRIMARY KEY);
- changeType: 1
want:
- status: 2
code: 803
@@ -10,9 +9,7 @@
column: 0
endposition: null
- statement: CREATE TABLE t(id INT PRIMARY KEY);
- changeType: 1
- statement: CREATE TABLE t(id VARCHAR(5), PRIMARY KEY(id));
- changeType: 1
want:
- status: 2
code: 803
@@ -23,7 +20,6 @@
column: 0
endposition: null
- statement: CREATE TABLE t(id INT, id2 VARCHAR(5), id3 VARCHAR(5), PRIMARY KEY(id, id2, id3));
- changeType: 1
want:
- status: 2
code: 803
@@ -42,13 +38,10 @@
column: 0
endposition: null
- statement: CREATE TABLE t(id INT, id2 BIGINT, PRIMARY KEY(id, id2));
- changeType: 1
- statement: CREATE TABLE t(id INT, PRIMARY KEY(id));
- changeType: 1
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN id VARCHAR(5) PRIMARY KEY;
- changeType: 1
want:
- status: 2
code: 803
@@ -61,11 +54,9 @@
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN id INT PRIMARY KEY;
- changeType: 1
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN id VARCHAR(5), ADD PRIMARY KEY (id);
- changeType: 1
want:
- status: 2
code: 803
@@ -78,7 +69,6 @@
- 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);
- changeType: 1
want:
- status: 2
code: 803
@@ -99,15 +89,12 @@
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN id INT, ADD COLUMN id2 BIGINT, ADD PRIMARY KEY (id, id2);
- changeType: 1
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN id BIGINT, ADD PRIMARY KEY (id);
- changeType: 1
- statement: |-
CREATE TABLE t(id VARCHAR(5));
ALTER TABLE t ADD PRIMARY KEY(id);
- changeType: 1
want:
- status: 2
code: 803
@@ -120,7 +107,6 @@
- statement: |-
CREATE TABLE t(id INT, id2 VARCHAR(5), id3 VARCHAR(5));
ALTER TABLE t ADD PRIMARY KEY(id, id2, id3);
- changeType: 1
want:
- status: 2
code: 803
@@ -141,15 +127,12 @@
- statement: |-
CREATE TABLE t(id INT, id2 BIGINT);
ALTER TABLE t ADD PRIMARY KEY(id, id2);
- changeType: 1
- statement: |-
CREATE TABLE t(id BIGINT);
ALTER TABLE t ADD PRIMARY KEY(id);
- changeType: 1
- statement: |-
CREATE TABLE t(id int);
ALTER TABLE t MODIFY COLUMN id VARCHAR(5) PRIMARY KEY;
- changeType: 1
want:
- status: 2
code: 803
@@ -162,11 +145,9 @@
- statement: |-
CREATE TABLE t(id int);
ALTER TABLE t MODIFY COLUMN id INT(5) PRIMARY KEY;
- changeType: 1
- statement: |-
CREATE TABLE t(id int);
ALTER TABLE t CHANGE COLUMN id id2 VARCHAR(5) PRIMARY KEY;
- changeType: 1
want:
- status: 2
code: 803
@@ -179,4 +160,3 @@
- statement: |-
CREATE TABLE t(id int);
ALTER TABLE t CHANGE COLUMN id id2 INT(5) PRIMARY KEY;
- changeType: 1
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 1da58bdcea..68c982ce7f 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
@@ -1,5 +1,4 @@
- statement: CREATE TABLE t(id VARCHAR(5) PRIMARY KEY);
- changeType: 1
want:
- status: 2
code: 803
@@ -10,9 +9,7 @@
column: 0
endposition: null
- statement: CREATE TABLE t(id INT PRIMARY KEY);
- changeType: 1
- statement: CREATE TABLE t(id VARCHAR(5), PRIMARY KEY(id));
- changeType: 1
want:
- status: 2
code: 803
@@ -23,7 +20,6 @@
column: 0
endposition: null
- statement: CREATE TABLE t(id INT, id2 VARCHAR(5), id3 VARCHAR(5), PRIMARY KEY(id, id2, id3));
- changeType: 1
want:
- status: 2
code: 803
@@ -42,13 +38,10 @@
column: 0
endposition: null
- statement: CREATE TABLE t(id INT, id2 BIGINT, PRIMARY KEY(id, id2));
- changeType: 1
- statement: CREATE TABLE t(id INT, PRIMARY KEY(id));
- changeType: 1
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN id VARCHAR(5) PRIMARY KEY;
- changeType: 1
want:
- status: 2
code: 803
@@ -61,11 +54,9 @@
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN id INT PRIMARY KEY;
- changeType: 1
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN id VARCHAR(5), ADD PRIMARY KEY (id);
- changeType: 1
want:
- status: 2
code: 803
@@ -78,7 +69,6 @@
- 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);
- changeType: 1
want:
- status: 2
code: 803
@@ -99,15 +89,12 @@
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN id INT, ADD COLUMN id2 BIGINT, ADD PRIMARY KEY (id, id2);
- changeType: 1
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN id BIGINT, ADD PRIMARY KEY (id);
- changeType: 1
- statement: |-
CREATE TABLE t(id VARCHAR(5));
ALTER TABLE t ADD PRIMARY KEY(id);
- changeType: 1
want:
- status: 2
code: 803
@@ -120,7 +107,6 @@
- statement: |-
CREATE TABLE t(id INT, id2 VARCHAR(5), id3 VARCHAR(5));
ALTER TABLE t ADD PRIMARY KEY(id, id2, id3);
- changeType: 1
want:
- status: 2
code: 803
@@ -141,15 +127,12 @@
- statement: |-
CREATE TABLE t(id INT, id2 BIGINT);
ALTER TABLE t ADD PRIMARY KEY(id, id2);
- changeType: 1
- statement: |-
CREATE TABLE t(id BIGINT);
ALTER TABLE t ADD PRIMARY KEY(id);
- changeType: 1
- statement: |-
CREATE TABLE t(id int);
ALTER TABLE t MODIFY COLUMN id VARCHAR(5) PRIMARY KEY;
- changeType: 1
want:
- status: 2
code: 803
@@ -162,11 +145,9 @@
- statement: |-
CREATE TABLE t(id int);
ALTER TABLE t MODIFY COLUMN id INT(5) PRIMARY KEY;
- changeType: 1
- statement: |-
CREATE TABLE t(id int);
ALTER TABLE t CHANGE COLUMN id id2 VARCHAR(5) PRIMARY KEY;
- changeType: 1
want:
- status: 2
code: 803
@@ -179,4 +160,3 @@
- statement: |-
CREATE TABLE t(id int);
ALTER TABLE t CHANGE COLUMN id id2 INT(5) PRIMARY KEY;
- changeType: 1
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 f1fbc629df..52366e0316 100644
--- a/backend/plugin/advisor/mysql/test/index_total_number_limit.yaml
+++ b/backend/plugin/advisor/mysql/test/index_total_number_limit.yaml
@@ -1,14 +1,11 @@
- statement: CREATE TABLE t(a int, b int, c int, unique key(a, b, c));
- changeType: 1
- statement: CREATE INDEX idx_id_name on tech_book(id, name);
- changeType: 1
- statement: |-
CREATE INDEX idx_id_name_1 on tech_book(id, name);
CREATE INDEX idx_id_name_2 on tech_book(id, name);
CREATE INDEX idx_id_name_3 on tech_book(id, name);
CREATE INDEX idx_id_name_4 on tech_book(id, name);
CREATE INDEX idx_id_name_5 on tech_book(id, name);
- changeType: 1
want:
- status: 2
code: 813
@@ -25,7 +22,6 @@
CREATE INDEX idx_a_b_3 on t(a, b);
CREATE INDEX idx_a_b_4 on t(a, b);
CREATE INDEX idx_a_b_5 on t(a, b);
- changeType: 1
want:
- status: 2
code: 813
@@ -45,7 +41,6 @@
INDEX idx_a_b_3 (a, b),
INDEX idx_a_b_4 (a, b),
INDEX idx_a_b_5 (a, b));
- changeType: 1
want:
- status: 2
code: 813
@@ -66,7 +61,6 @@
ALTER TABLE t ADD INDEX idx_a_b_3 (a, b);
ALTER TABLE t ADD INDEX idx_a_b_4 (a, b);
ALTER TABLE t ADD INDEX idx_a_b_5 (a, b);
- changeType: 1
want:
- status: 2
code: 813
diff --git a/backend/plugin/advisor/mysql/test/index_type_allow_list.yaml b/backend/plugin/advisor/mysql/test/index_type_allow_list.yaml
index 84957c82a4..4d51d78aaa 100644
--- a/backend/plugin/advisor/mysql/test/index_type_allow_list.yaml
+++ b/backend/plugin/advisor/mysql/test/index_type_allow_list.yaml
@@ -4,7 +4,6 @@
email VARCHAR(100),
INDEX idx_email (email)
);
- changeType: 1
- statement: |-
CREATE TABLE orders (
id INT PRIMARY KEY,
@@ -13,14 +12,12 @@
);
CREATE INDEX idx_customer ON orders (customer, (order_number * 2));
CREATE INDEX idx_customer_duplicate ON orders (customer, (order_number * 2));
- changeType: 1
- statement: |-
CREATE TABLE locations (
id INT AUTO_INCREMENT PRIMARY KEY,
geom GEOMETRY NOT NULL
);
CREATE SPATIAL INDEX spatial_index_name ON locations(geom);
- changeType: 1
want:
- status: 2
code: 816
@@ -36,7 +33,6 @@
description TEXT NOT NULL
);
CREATE FULLTEXT INDEX fulltext_index_name ON locations(description);
- changeType: 1
want:
- status: 2
code: 816
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 747f1ab3eb..c7fd537402 100644
--- a/backend/plugin/advisor/mysql/test/index_type_no_blob.yaml
+++ b/backend/plugin/advisor/mysql/test/index_type_no_blob.yaml
@@ -11,7 +11,6 @@
UNIQUE KEY uk1(id, name),
FOREIGN KEY fk1(roomId) REFERENCES room(id),
INDEX idx_userTable_content(content)) ENGINE = CSV COLLATE latin1_bin;
- changeType: 1
want:
- status: 2
code: 804
@@ -33,9 +32,7 @@
INDEX idx_user_name(name),
UNIQUE KEY uk_user_id_name(id, name)
) ENGINE = INNODB COMMENT 'comment';
- changeType: 1
- statement: CREATE TABLE t(b BLOB, PRIMARY KEY(b(10)));
- changeType: 1
want:
- status: 2
code: 804
@@ -46,7 +43,6 @@
column: 0
endposition: null
- statement: CREATE TABLE t(b BLOB, mb MEDIUMBLOB, lb LONGBLOB, id INT, PRIMARY KEY(b(1), mb(2), lb(3), id));
- changeType: 1
want:
- status: 2
code: 804
@@ -73,7 +69,6 @@
column: 0
endposition: null
- statement: CREATE TABLE t(b BLOB, mb MEDIUMBLOB, lb LONGBLOB, id INT, UNIQUE INDEX(b(1), mb(2), lb(3), id))
- changeType: 1
want:
- status: 2
code: 804
@@ -100,7 +95,6 @@
column: 0
endposition: null
- statement: CREATE TABLE t(b BLOB, mb MEDIUMBLOB, lb LONGBLOB, id iNT, INDEX(b(1), mb(2), lb(3), id))
- changeType: 1
want:
- status: 2
code: 804
@@ -127,11 +121,9 @@
column: 0
endposition: null
- statement: CREATE TABLE t(id INT, PRIMARY KEY(id))
- changeType: 1
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t ADD COLUMN b BLOB, ADD COLUMN id INT, ADD PRIMARY KEY(b(1), id);
- changeType: 1
want:
- status: 2
code: 804
@@ -144,7 +136,6 @@
- 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)
- changeType: 1
want:
- status: 2
code: 804
@@ -173,7 +164,6 @@
- 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)
- changeType: 1
want:
- status: 2
code: 804
@@ -202,14 +192,12 @@
- 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);
- changeType: 1
- 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);
- changeType: 1
want:
- status: 2
code: 804
@@ -238,12 +226,10 @@
- statement: |-
CREATE TABLE t(b blob, mb mediumblob, lb longblob, id int);
CREATE INDEX idx_id ON t(id);
- changeType: 1
- 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);
- changeType: 1
want:
- status: 2
code: 804
@@ -257,7 +243,6 @@
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);
- changeType: 1
want:
- status: 2
code: 804
diff --git a/backend/plugin/advisor/mysql/test/naming_column.yaml b/backend/plugin/advisor/mysql/test/naming_column.yaml
index e6d357285d..deb6733efb 100644
--- a/backend/plugin/advisor/mysql/test/naming_column.yaml
+++ b/backend/plugin/advisor/mysql/test/naming_column.yaml
@@ -1,5 +1,4 @@
- statement: CREATE TABLE book(id int, creatorId int);
- changeType: 1
want:
- status: 2
code: 302
@@ -10,7 +9,6 @@
column: 0
endposition: null
- statement: CREATE TABLE book(id int, gbhzmtchhsjzyrhdroxmyouwloxqezowdvhcbqalqcgqhfbjnvmhwrbggezmzeusx int);
- changeType: 1
want:
- status: 2
code: 302
@@ -21,12 +19,10 @@
column: 0
endposition: null
- statement: CREATE TABLE book(id int, creator_id int);
- changeType: 1
- statement: |-
CREATE TABLE book(id int, creator_id int);
ALTER TABLE book RENAME COLUMN creator_id TO creatorId;
ALTER TABLE book CHANGE COLUMN creatorId gbhzmtchhsjzyrhdroxmyouwloxqezowdvhcbqalqcgqhfbjnvmhwrbggezmzeusx int;
- changeType: 1
want:
- status: 2
code: 302
@@ -47,7 +43,6 @@
- statement: |
ALTER TABLE tech_book RENAME COLUMN id TO creator_id;
ALTER TABLE tech_book RENAME COLUMN creator_id TO gbhzmtchhsjzyrhdroxmyouwloxqezowdvhcbqalqcgqhfbjnvmhwrbggezmzeusx;
- changeType: 1
want:
- status: 2
code: 302
@@ -65,7 +60,6 @@
updater_id int,
updated_ts timestamp);
ALTER TABLE book CHANGE COLUMN creator_id creatorId int;
- changeType: 1
want:
- status: 2
code: 302
@@ -78,9 +72,7 @@
- statement: |-
CREATE TABLE book (id INT);
ALTER TABLE book CHANGE COLUMN id creator_id int;
- changeType: 1
- statement: ALTER TABLE tech_book DROP COLUMN id;
- changeType: 1
- statement: |-
CREATE TABLE book(
id int,
@@ -88,7 +80,6 @@
created_ts timestamp,
updated_ts timestamp);
ALTER TABLE book ADD COLUMN contentString varchar(255);
- changeType: 1
want:
- status: 2
code: 302
@@ -105,7 +96,6 @@
created_ts timestamp,
updated_ts timestamp);
ALTER TABLE book ADD COLUMN (personAge INT, contentString varchar(255));
- changeType: 1
want:
- status: 2
code: 302
@@ -133,7 +123,6 @@
id int,
createdTs timestamp,
updatedTs timestamp);
- changeType: 1
want:
- status: 2
code: 302
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 14a379d4c6..530e8a5d4f 100644
--- a/backend/plugin/advisor/mysql/test/naming_column_auto_increment.yaml
+++ b/backend/plugin/advisor/mysql/test/naming_column_auto_increment.yaml
@@ -1,7 +1,5 @@
- statement: CREATE TABLE book(id int AUTO_INCREMENT);
- changeType: 1
- statement: CREATE TABLE book(a int AUTO_INCREMENT);
- changeType: 1
want:
- status: 2
code: 307
@@ -12,7 +10,6 @@
column: 0
endposition: null
- statement: ALTER TABLE tech_book ADD COLUMN a int AUTO_INCREMENT;
- changeType: 1
want:
- status: 2
code: 307
@@ -23,7 +20,6 @@
column: 0
endposition: null
- statement: ALTER TABLE tech_book CHANGE COLUMN id a int AUTO_INCREMENT;
- changeType: 1
want:
- status: 2
code: 307
@@ -34,7 +30,6 @@
column: 0
endposition: null
- statement: ALTER TABLE tech_book MODIFY COLUMN name int AUTO_INCREMENT;
- changeType: 1
want:
- status: 2
code: 307
@@ -47,16 +42,12 @@
- statement: |
CREATE TABLE book(id int);
ALTER TABLE tech_book MODIFY COLUMN id int AUTO_INCREMENT;
- changeType: 1
- statement: |
CREATE TABLE book(name VARCHAR(255));
ALTER TABLE book ADD COLUMN id int AUTO_INCREMENT;
- changeType: 1
- statement: |
CREATE TABLE book(a INT, name VARCHAR(255));
ALTER TABLE book CHANGE COLUMN a id int AUTO_INCREMENT;
- changeType: 1
- statement: |
CREATE TABLE book(name VARCHAR(255));
ALTER TABLE book ADD COLUMN (id int AUTO_INCREMENT, a int, b int, c int, d int);
- changeType: 1
diff --git a/backend/plugin/advisor/mysql/test/naming_identifier_no_keyword.yaml b/backend/plugin/advisor/mysql/test/naming_identifier_no_keyword.yaml
index 946966c37f..8470816122 100644
--- a/backend/plugin/advisor/mysql/test/naming_identifier_no_keyword.yaml
+++ b/backend/plugin/advisor/mysql/test/naming_identifier_no_keyword.yaml
@@ -1,18 +1,17 @@
- statement: CREATE TABLE `t`(a int);
- changeType: 1
- statement: CREATE TABLE interval(id int);
- changeType: 1
want:
- status: 3
code: 201
title: Syntax error
- content: "Syntax error at line 1:14 \nrelated text: CREATE TABLE interval"
+ content: |-
+ Syntax error at line 1:14: expected identifier
+ related text: CREATE TABLE interval(id int);
startposition:
line: 1
column: 14
endposition: null
- statement: CREATE TABLE execute(id int)
- changeType: 1
want:
- status: 2
code: 308
@@ -23,7 +22,6 @@
column: 0
endposition: null
- statement: CREATE TABLE `execute`(id int)
- changeType: 1
want:
- status: 2
code: 308
@@ -34,7 +32,6 @@
column: 0
endposition: null
- statement: CREATE TABLE `interval`(id int);
- changeType: 1
want:
- status: 2
code: 308
@@ -45,7 +42,6 @@
column: 0
endposition: null
- statement: "CREATE TABLE t(\n id int, \n `current_timestamp` int\n);\n"
- changeType: 1
want:
- status: 2
code: 308
@@ -56,7 +52,6 @@
column: 0
endposition: null
- statement: CREATE TABLE `test`.`interval`(id int);
- changeType: 1
want:
- status: 2
code: 308
diff --git a/backend/plugin/advisor/mysql/test/naming_index_fk.yaml b/backend/plugin/advisor/mysql/test/naming_index_fk.yaml
index b53bc97a19..e561599485 100644
--- a/backend/plugin/advisor/mysql/test/naming_index_fk.yaml
+++ b/backend/plugin/advisor/mysql/test/naming_index_fk.yaml
@@ -1,5 +1,4 @@
- statement: CREATE TABLE userTable(id INT NOT NULL,name VARCHAR(255) CHARSET ascii,roomId INT,time_created TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE NOW() COMMENT 'comment',time_updated TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE NOW() COMMENT 'comment',content BLOB NOT NULL COMMENT 'comment',json_content JSON NOT NULL COMMENT 'comment',INDEX idx1(name),UNIQUE KEY uk1(id, name),FOREIGN KEY fk1(roomId) REFERENCES room(id),INDEX idx_userTable_content(content)) ENGINE = CSV COLLATE latin1_bin;
- changeType: 1
want:
- status: 2
code: 305
@@ -10,9 +9,7 @@
column: 0
endposition: null
- statement: ALTER TABLE tech_book ADD CONSTRAINT fk_tech_book_author_id_author_id FOREIGN KEY (author_id) REFERENCES author (id);
- changeType: 1
- statement: ALTER TABLE tech_book ADD CONSTRAINT fk_author_id FOREIGN KEY (author_id) REFERENCES author (id);
- changeType: 1
want:
- status: 2
code: 305
@@ -23,7 +20,6 @@
column: 0
endposition: null
- statement: ALTER TABLE tech_book ADD CONSTRAINT rvemempmcmmhutaskvcidmwaldtfjdgmcpkhmibtadfydtkexpuzczrrneucthfwk FOREIGN KEY (author_id) REFERENCES author (id);
- changeType: 1
want:
- status: 2
code: 305
@@ -47,21 +43,18 @@
author_id INT,
FOREIGN KEY fk_book_author_id_author_id (author_id) REFERENCES author (id)
);
- changeType: 1
- statement: |
CREATE TABLE book(
id INT,
author_id INT,
FOREIGN KEY (author_id) REFERENCES author (id)
);
- changeType: 1
- statement: |
CREATE TABLE book(
id INT,
author_id INT,
FOREIGN KEY fk_book_author_id (author_id) REFERENCES author (id)
);
- changeType: 1
want:
- status: 2
code: 305
diff --git a/backend/plugin/advisor/mysql/test/naming_index_idx.yaml b/backend/plugin/advisor/mysql/test/naming_index_idx.yaml
index 0fdddc42d4..1abfa88d31 100644
--- a/backend/plugin/advisor/mysql/test/naming_index_idx.yaml
+++ b/backend/plugin/advisor/mysql/test/naming_index_idx.yaml
@@ -1,7 +1,5 @@
- statement: CREATE INDEX idx_tech_book_id_name ON tech_book(id, name);
- changeType: 1
- statement: CREATE INDEX tech_book_id_name ON tech_book(id, name);
- changeType: 1
want:
- status: 2
code: 303
@@ -12,7 +10,6 @@
column: 0
endposition: null
- statement: CREATE INDEX afvjwsgrbgqzjfrkmbcoxzstznuypasijbbcdykoboredqovetzfcmmqliaelyavw ON tech_book(id, name);
- changeType: 1
want:
- status: 2
code: 303
@@ -31,9 +28,7 @@
column: 0
endposition: null
- statement: ALTER TABLE tech_book RENAME INDEX old_index TO idx_tech_book_id_name;
- changeType: 1
- statement: ALTER TABLE tech_book RENAME INDEX old_index TO idx_tech_book;
- changeType: 1
want:
- status: 2
code: 303
@@ -44,9 +39,7 @@
column: 0
endposition: null
- statement: ALTER TABLE tech_book ADD INDEX idx_tech_book_id_name (id, name);
- changeType: 1
- statement: ALTER TABLE tech_book ADD INDEX tech_book_id_name (id, name);
- changeType: 1
want:
- status: 2
code: 303
@@ -57,12 +50,7 @@
column: 0
endposition: null
- statement: CREATE TABLE tech_book_copy(id INT PRIMARY KEY, name VARCHAR(20), INDEX idx_tech_book_copy_name (name));
- changeType: 1
- statement: CREATE TABLE tech_book_copy(id INT PRIMARY KEY, name VARCHAR(20), INDEX (name));
- changeType: 1
- statement: CREATE TABLE tech_book_copy(id INT PRIMARY KEY, name VARCHAR(20), UNIQUE INDEX (name));
- changeType: 1
- statement: CREATE TABLE tech_book_copy(id INT PRIMARY KEY, name VARCHAR(20), FULLTEXT INDEX (name));
- changeType: 1
- statement: CREATE TABLE tech_book_copy(id INT PRIMARY KEY, name VARCHAR(20), SPATIAL INDEX (name));
- changeType: 1
diff --git a/backend/plugin/advisor/mysql/test/naming_index_uk.yaml b/backend/plugin/advisor/mysql/test/naming_index_uk.yaml
index be3b1f1542..b3f8c7ed53 100644
--- a/backend/plugin/advisor/mysql/test/naming_index_uk.yaml
+++ b/backend/plugin/advisor/mysql/test/naming_index_uk.yaml
@@ -1,9 +1,7 @@
- statement: CREATE UNIQUE INDEX uk_tech_book_id_name ON tech_book(id, name);
- changeType: 1
- statement: |
CREATE UNIQUE INDEX uk_tech_book_id_name ON tech_book(id, name);
CREATE UNIQUE INDEX tech_book_id_name ON tech_book(id, name);
- changeType: 1
want:
- status: 2
code: 304
@@ -16,7 +14,6 @@
- statement: |
CREATE UNIQUE INDEX uk_tech_book_id_name ON tech_book(id, name);
CREATE UNIQUE INDEX qtzmquwvlnttctfluoouxelxeliltcfzzstrtyocogwwyiyrflmrkbhbfasynlacy ON tech_book(id, name)
- changeType: 1
want:
- status: 2
code: 304
@@ -35,11 +32,9 @@
column: 0
endposition: null
- statement: ALTER TABLE tech_book ADD UNIQUE uk_tech_book_id_name (id, name);
- changeType: 1
- statement: |
CREATE TABLE t1(a INT);
ALTER TABLE tech_book ADD UNIQUE tech_book_id_name (id, name);
- changeType: 1
want:
- status: 2
code: 304
@@ -50,11 +45,9 @@
column: 0
endposition: null
- statement: ALTER TABLE tech_book RENAME INDEX old_uk TO uk_tech_book_id_name;
- changeType: 1
- statement: |
CREATE TABLE t1(a INT);
ALTER TABLE tech_book RENAME INDEX old_uk TO uk_tech_book;
- changeType: 1
want:
- status: 2
code: 304
@@ -65,18 +58,15 @@
column: 0
endposition: null
- statement: CREATE TABLE book(id INT PRIMARY KEY, name VARCHAR(20), UNIQUE INDEX uk_book_name (name));
- changeType: 1
- statement: |
CREATE TABLE book(
id INT PRIMARY KEY,
name VARCHAR(20),
UNIQUE KEY (name)
);
- changeType: 1
- statement: |
CREATE TABLE book(
id INT PRIMARY KEY,
name VARCHAR(20),
UNIQUE INDEX (name)
);
- changeType: 1
diff --git a/backend/plugin/advisor/mysql/test/naming_table.yaml b/backend/plugin/advisor/mysql/test/naming_table.yaml
index dd860c8a32..df19df0f45 100644
--- a/backend/plugin/advisor/mysql/test/naming_table.yaml
+++ b/backend/plugin/advisor/mysql/test/naming_table.yaml
@@ -1,5 +1,4 @@
- statement: CREATE TABLE techBook(id int, name varchar(255));
- changeType: 1
want:
- status: 2
code: 301
@@ -10,9 +9,7 @@
column: 0
endposition: null
- statement: CREATE TABLE tech_book_copy(id int, name varchar(255));
- changeType: 1
- statement: CREATE TABLE cjnubexocfhqoogdmihudyahmmghviqkzvpixnwvxtxumvuannpwdcbtsgwrvzpde(id int, name varchar(255));
- changeType: 1
want:
- status: 2
code: 301
@@ -25,7 +22,6 @@
- statement: |
CREATE TABLE book(a INT);
ALTER TABLE book RENAME TO TechBook;
- changeType: 1
want:
- status: 2
code: 301
@@ -38,11 +34,9 @@
- statement: |
CREATE TABLE book(a INT);
ALTER TABLE book RENAME TO tech_book_copy;
- changeType: 1
- statement: |
CREATE TABLE book (a INT);
RENAME TABLE book TO tech_book_copy, tech_book_copy TO LiteraryBook;
- changeType: 1
want:
- status: 2
code: 301
@@ -56,7 +50,6 @@
CREATE TABLE literary_book(a int);
CREATE TABLE book(a int);
RENAME TABLE book TO TechBook, literary_book TO LiteraryBook;
- changeType: 1
want:
- status: 2
code: 301
@@ -78,4 +71,3 @@
CREATE TABLE literary_book(a int);
CREATE TABLE book(a int);
RENAME TABLE book TO tech_book_copy, literary_book TO literary_book_copy;
- changeType: 1
diff --git a/backend/plugin/advisor/mysql/test/schema_backward_compatibility.yaml b/backend/plugin/advisor/mysql/test/schema_backward_compatibility.yaml
index deaf1e577e..adfc0b37b9 100644
--- a/backend/plugin/advisor/mysql/test/schema_backward_compatibility.yaml
+++ b/backend/plugin/advisor/mysql/test/schema_backward_compatibility.yaml
@@ -1,5 +1,4 @@
- statement: ALTER TABLE tech_book CHANGE name f2 TEXT;
- changeType: 1
want:
- status: 2
code: 111
@@ -10,7 +9,6 @@
column: 0
endposition: null
- statement: ALTER TABLE tech_book MODIFY name TEXT;
- changeType: 1
want:
- status: 2
code: 111
@@ -21,7 +19,6 @@
column: 0
endposition: null
- statement: ALTER TABLE tech_book MODIFY name TEXT NULL;
- changeType: 1
want:
- status: 2
code: 111
@@ -32,7 +29,6 @@
column: 0
endposition: null
- statement: ALTER TABLE tech_book MODIFY name TEXT NOT NULL;
- changeType: 1
want:
- status: 2
code: 111
@@ -43,7 +39,6 @@
column: 0
endposition: null
- statement: ALTER TABLE tech_book MODIFY name TEXT COMMENT 'bla';
- changeType: 1
want:
- status: 2
code: 111
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 cc7cd62f04..57e738764f 100644
--- a/backend/plugin/advisor/mysql/test/statement_affected_row_limit.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_affected_row_limit.yaml
@@ -1,4 +1,2 @@
- statement: DELETE FROM tech_book WHERE a > 1;
- changeType: 1
- statement: UPDATE tech_book SET id = 1;
- changeType: 1
diff --git a/backend/plugin/advisor/mysql/test/statement_disallow_commit.yaml b/backend/plugin/advisor/mysql/test/statement_disallow_commit.yaml
index 3f2413a5a4..e9d2cd7dca 100644
--- a/backend/plugin/advisor/mysql/test/statement_disallow_commit.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_disallow_commit.yaml
@@ -2,7 +2,6 @@
START TRANSACTION;
CREATE TABLE techBook(id int, name varchar(255));
COMMIT;
- changeType: 1
want:
- status: 2
code: 206
@@ -20,7 +19,6 @@
START TRANSACTION;
INSERT INTO techBook(id, name) VALUES(1, "book");
COMMIT;
- changeType: 1
want:
- status: 2
code: 206
diff --git a/backend/plugin/advisor/mysql/test/statement_disallow_limit.yaml b/backend/plugin/advisor/mysql/test/statement_disallow_limit.yaml
index 18da231d0f..0bc3d19d05 100644
--- a/backend/plugin/advisor/mysql/test/statement_disallow_limit.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_disallow_limit.yaml
@@ -1,9 +1,7 @@
- statement: INSERT INTO tech_book SELECT * FROM tech_book;
- changeType: 1
- statement: |
INSERT INTO tech_book SELECT * FROM tech_book;
INSERT INTO tech_book SELECT * FROM tech_book LIMIT 1;
- changeType: 1
want:
- status: 2
code: 1103
@@ -16,7 +14,6 @@
- statement: |
INSERT INTO tech_book SELECT * FROM tech_book;
INSERT INTO tech_book SELECT * FROM tech_book UNION SELECT * FROM tech_book LIMIT 1;
- changeType: 1
want:
- status: 2
code: 1103
@@ -29,7 +26,6 @@
- statement: |
INSERT INTO tech_book SELECT * FROM tech_book;
INSERT INTO tech_book SELECT * FROM tech_book UNION SELECT * FROM tech_book LIMIT 1;
- changeType: 1
want:
- status: 2
code: 1103
@@ -42,7 +38,6 @@
- statement: |
UPDATE tech_book SET name = 'my name';
UPDATE tech_book SET name = 'my name' LIMIT 10;
- changeType: 1
want:
- status: 2
code: 1102
@@ -55,7 +50,6 @@
- statement: |
DELETE FROM tech_book;
DELETE FROM tech_book LIMIT 10;
- changeType: 1
want:
- status: 2
code: 1106
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 647be18a4c..2789c4b9aa 100644
--- a/backend/plugin/advisor/mysql/test/statement_disallow_order_by.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_disallow_order_by.yaml
@@ -1,9 +1,7 @@
- statement: INSERT INTO tech_book values(1, 'a');
- changeType: 1
- statement: |-
UPDATE tech_book SET name = 'my name';
UPDATE tech_book SET name = 'my name' ORDER BY id;
- changeType: 1
want:
- status: 2
code: 1104
@@ -16,7 +14,6 @@
- statement: |-
DELETE FROM tech_book;
DELETE FROM tech_book ORDER BY id;
- changeType: 1
want:
- status: 2
code: 1105
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 e353b15447..449cbfac8e 100644
--- a/backend/plugin/advisor/mysql/test/statement_dml_dry_run.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_dml_dry_run.yaml
@@ -1,6 +1,3 @@
- statement: INSERT INTO tech_book values(1, 'zp');
- changeType: 1
- statement: DELETE FROM tech_book;
- changeType: 1
- statement: UPDATE tech_book SET name = 'xz' WHERE id = 1;
- changeType: 1
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 273e97f540..c47e318328 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
@@ -1,9 +1,7 @@
- statement: INSERT INTO tech_book VALUES(1, "a");
- changeType: 1
- statement: |-
INSERT INTO tech_book VALUES(1, "a");
INSERT INTO tech_book SELECT * FROM tech_book ORDER BY rand();
- changeType: 1
want:
- status: 2
code: 1108
@@ -16,7 +14,6 @@
- statement: |-
INSERT INTO tech_book VALUES(1, "a");
INSERT INTO tech_book SELECT * FROM tech_book ORDER BY RAND() LIMIT 1;
- changeType: 1
want:
- status: 2
code: 1108
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 c72d8428d4..27cfa98381 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
@@ -1,5 +1,4 @@
- statement: INSERT INTO t_copy SELECT * FROM t;
- changeType: 1
want:
- status: 2
code: 1107
@@ -10,9 +9,7 @@
column: 0
endposition: null
- statement: INSERT INTO tech_book(id, name) VALUES (1, '1');
- changeType: 1
- statement: "INSERT INTO tech_book(id, name) VALUES (1, '1'); \nINSERT INTO tech_book VALUES (1, '1');"
- changeType: 1
want:
- status: 2
code: 1107
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 aa1af98470..8032dd743b 100644
--- a/backend/plugin/advisor/mysql/test/statement_insert_row_limit.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_insert_row_limit.yaml
@@ -1,9 +1,7 @@
- statement: INSERT INTO tech_book values(1, 'a');
- changeType: 1
- statement: |
INSERT INTO tech_book values(1, 'a');
INSERT INTO tech_book values(1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e'), (6, 'f');
- changeType: 1
want:
- status: 2
code: 1101
@@ -14,4 +12,3 @@
column: 0
endposition: null
- statement: INSERT INTO tech_book SELECT * FROM tech_book;
- changeType: 1
diff --git a/backend/plugin/advisor/mysql/test/statement_max_execution_time.yaml b/backend/plugin/advisor/mysql/test/statement_max_execution_time.yaml
index 48570acdab..fa29da1afe 100644
--- a/backend/plugin/advisor/mysql/test/statement_max_execution_time.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_max_execution_time.yaml
@@ -1,9 +1,6 @@
- statement: SET MAX_EXECUTION_TIME = 1000; SELECT * FROM employee;
- changeType: 1
- statement: SET GLOBAL max_execution_time = 10; SELECT * FROM employee;
- changeType: 1
- statement: SELECT * FROM employee; SET max_execution_time = 1000;
- changeType: 1
want:
- status: 2
code: 235
@@ -12,7 +9,6 @@
startposition: null
endposition: null
- statement: SELECT * FROM t;
- changeType: 1
want:
- status: 2
code: 235
diff --git a/backend/plugin/advisor/mysql/test/statement_maximum_join_table_count.yaml b/backend/plugin/advisor/mysql/test/statement_maximum_join_table_count.yaml
index 728e16ebab..0c6ef8125b 100644
--- a/backend/plugin/advisor/mysql/test/statement_maximum_join_table_count.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_maximum_join_table_count.yaml
@@ -1,7 +1,5 @@
- statement: SELECT * FROM t;
- changeType: 1
- statement: select name from hello join world on hello.id = world.id join baby on world.id = baby.id;
- changeType: 1
want:
- status: 2
code: 223
diff --git a/backend/plugin/advisor/mysql/test/statement_maximum_limit_value.yaml b/backend/plugin/advisor/mysql/test/statement_maximum_limit_value.yaml
index ec1bc9b686..edf70ae3a2 100644
--- a/backend/plugin/advisor/mysql/test/statement_maximum_limit_value.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_maximum_limit_value.yaml
@@ -1,6 +1,5 @@
- statement: |
SELECT * FROM employee LIMIT 1000000;
- changeType: 1
want:
- status: 2
code: 222
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 8f10d81b75..414e441462 100644
--- a/backend/plugin/advisor/mysql/test/statement_merge_alter_table.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_merge_alter_table.yaml
@@ -1,9 +1,7 @@
- statement: ALTER TABLE tech_book ADD COLUMN a int;
- changeType: 1
- statement: |-
ALTER TABLE tech_book ADD COLUMN a int;
ALTER TABLE tech_book CHANGE COLUMN a c int;
- changeType: 1
want:
- status: 2
code: 207
@@ -18,7 +16,6 @@
ALTER TABLE tech_book ADD COLUMN b int;
ALTER TABLE t ADD COLUMN b int;
ALTER TABLE tech_book MODIFY COLUMN b varchar(255);
- changeType: 1
want:
- status: 2
code: 207
@@ -41,7 +38,6 @@
ALTER TABLE tech_book ADD COLUMN a int;
ALTER TABLE tech_book ADD COLUMN b int;
ALTER TABLE t ADD COLUMN b int;
- changeType: 1
want:
- status: 2
code: 207
diff --git a/backend/plugin/advisor/mysql/test/statement_require_algorithm_option.yaml b/backend/plugin/advisor/mysql/test/statement_require_algorithm_option.yaml
index 79e734ecac..edc8a02c68 100644
--- a/backend/plugin/advisor/mysql/test/statement_require_algorithm_option.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_require_algorithm_option.yaml
@@ -1,11 +1,9 @@
- statement: |
CREATE TABLE t(b int);
ALTER TABLE t ADD COLUMN c INT, ALGORITHM=INSTANT, LOCK=NONE;
- changeType: 1
- statement: |
CREATE TABLE t(b int);
ALTER TABLE t ADD COLUMN c INT;
- changeType: 1
want:
- status: 2
code: 236
diff --git a/backend/plugin/advisor/mysql/test/statement_require_lock_option.yaml b/backend/plugin/advisor/mysql/test/statement_require_lock_option.yaml
index 1c5605cf7c..8da710f438 100644
--- a/backend/plugin/advisor/mysql/test/statement_require_lock_option.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_require_lock_option.yaml
@@ -1,11 +1,9 @@
- statement: |
CREATE TABLE t(b int);
ALTER TABLE t ADD COLUMN c INT, ALGORITHM=INSTANT, LOCK=NONE;
- changeType: 1
- statement: |
CREATE TABLE t(b int);
ALTER TABLE t ADD COLUMN c INT;
- changeType: 1
want:
- status: 2
code: 237
@@ -19,7 +17,6 @@
CREATE TABLE t(b int);
ALTER TABLE t ADD COLUMN c INT, LOCK=NONE;
ALTER TABLE t ADD COLUMN d INT;
- changeType: 1
want:
- status: 2
code: 237
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 bd7ce1209d..3654e301b9 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
@@ -1,5 +1,4 @@
- statement: SELECT * FROM t;
- changeType: 1
want:
- status: 2
code: 203
@@ -10,12 +9,10 @@
column: 0
endposition: null
- statement: SELECT a, b FROM t;
- changeType: 1
- statement: |
SELECT a, b FROM t;
SELECT * FROM t;
SELECT a, b FROM (SELECT * from t1 JOIN t2) t;
- changeType: 1
want:
- status: 2
code: 203
@@ -38,7 +35,6 @@
SELECT * FROM t1
UNION
SELECT * FROM t2;
- changeType: 1
want:
- status: 2
code: 203
@@ -67,7 +63,6 @@
WITH cte AS (
SELECT * FROM a
) SELECT * FROM cte;
- changeType: 1
want:
- status: 2
code: 203
@@ -96,7 +91,6 @@
SELECT *
FROM a
INNER JOIN b USING(id);
- changeType: 1
want:
- status: 2
code: 203
diff --git a/backend/plugin/advisor/mysql/test/statement_where_disallow_functions_and_calculations.yaml b/backend/plugin/advisor/mysql/test/statement_where_disallow_functions_and_calculations.yaml
index 9795a42a82..db7269be56 100644
--- a/backend/plugin/advisor/mysql/test/statement_where_disallow_functions_and_calculations.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_where_disallow_functions_and_calculations.yaml
@@ -1,5 +1,4 @@
- statement: SELECT * FROM employee WHERE id = RAND();
- changeType: 1
want:
- status: 2
code: 1702
diff --git a/backend/plugin/advisor/mysql/test/statement_where_maximum_logical_operator_count.yaml b/backend/plugin/advisor/mysql/test/statement_where_maximum_logical_operator_count.yaml
index 5af84d3efb..4dcd670ad0 100644
--- a/backend/plugin/advisor/mysql/test/statement_where_maximum_logical_operator_count.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_where_maximum_logical_operator_count.yaml
@@ -1,5 +1,4 @@
- statement: SELECT * FROM employee WHERE id IN (1, 2, 3, 4, 5);
- changeType: 1
want:
- status: 2
code: 225
@@ -10,7 +9,6 @@
column: 0
endposition: null
- statement: SELECT * FROM employee WHERE id = 1 OR id = 2 OR id = 3 OR id = 4 OR id = 5;
- changeType: 1
want:
- status: 2
code: 225
diff --git a/backend/plugin/advisor/mysql/test/statement_where_no_equal_null.yaml b/backend/plugin/advisor/mysql/test/statement_where_no_equal_null.yaml
index 6a1d7efa89..661a105371 100644
--- a/backend/plugin/advisor/mysql/test/statement_where_no_equal_null.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_where_no_equal_null.yaml
@@ -1,12 +1,9 @@
- statement: |
SELECT * FROM employee WHERE name = 'Jack' AND id IS NULL;
- changeType: 1
- statement: |
UPDATE employee SET name = NULL;
- changeType: 1
- statement: |
SELECT * FROM t WHERE name = 'test' AND id = NULL;
- changeType: 1
want:
- status: 2
code: 221
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 1ab0285b34..c58d737a91 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
@@ -1,6 +1,5 @@
- statement: |
DELETE FROM tech_book WHERE name like "%abc";
- changeType: 1
want:
- status: 2
code: 204
@@ -13,11 +12,9 @@
- statement: |
CREATE TABLE t (id INT);
SELECT * FROM t WHERE a LIKE 'abc%';
- changeType: 1
- statement: |
CREATE TABLE t (id INT);
SELECT * FROM t WHERE a LIKE '%abc';
- changeType: 1
want:
- status: 2
code: 204
@@ -30,7 +27,6 @@
- statement: |
CREATE TABLE t (id INT);
SELECT * FROM t WHERE a LIKE 'abc' OR a LIKE '%abc';
- changeType: 1
want:
- status: 2
code: 204
@@ -46,7 +42,6 @@
FROM t
WHERE a LIKE '%acc'
OR a LIKE '%abc';
- changeType: 1
want:
- status: 2
code: 204
@@ -80,7 +75,6 @@
WHERE a LIKE '%acc'
OR a LIKE '%abc'
) t1;
- changeType: 1
want:
- status: 2
code: 204
diff --git a/backend/plugin/advisor/mysql/test/statement_where_require_select.yaml b/backend/plugin/advisor/mysql/test/statement_where_require_select.yaml
index 78ad014c49..8a9e2c20e0 100644
--- a/backend/plugin/advisor/mysql/test/statement_where_require_select.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_where_require_select.yaml
@@ -1,11 +1,9 @@
- statement: |
CREATE TABLE book(id INT);
INSERT INTO book(id) values (1);
- changeType: 1
- statement: |
CREATE TABLE book(id INT);
SELECT id FROM book;
- changeType: 1
want:
- status: 2
code: 202
@@ -18,7 +16,6 @@
- statement: |
CREATE TABLE book(id INT);
SELECT id FROM book WHERE id > 0;
- changeType: 1
- statement: |
CREATE TABLE book(id INT);
SELECT id
@@ -27,7 +24,6 @@
SELECT max(id)
FROM book
);
- changeType: 1
want:
- status: 2
code: 202
@@ -45,4 +41,3 @@
endposition: null
- statement: |
SELECT CURDATE();
- changeType: 1
diff --git a/backend/plugin/advisor/mysql/test/statement_where_require_update_delete.yaml b/backend/plugin/advisor/mysql/test/statement_where_require_update_delete.yaml
index 34abb23e4d..a5a757216f 100644
--- a/backend/plugin/advisor/mysql/test/statement_where_require_update_delete.yaml
+++ b/backend/plugin/advisor/mysql/test/statement_where_require_update_delete.yaml
@@ -1,11 +1,9 @@
- statement: |
CREATE TABLE book(id INT);
INSERT INTO book(id) values (1);
- changeType: 1
- statement: |
CREATE TABLE book(id INT);
DELETE FROM book;
- changeType: 1
want:
- status: 2
code: 202
@@ -18,7 +16,6 @@
- statement: |
CREATE TABLE book(id INT);
UPDATE book SET id = 1;
- changeType: 1
want:
- status: 2
code: 202
@@ -31,8 +28,6 @@
- statement: |
CREATE TABLE book(id INT);
DELETE FROM book WHERE id > 0;
- changeType: 1
- statement: |
CREATE TABLE book(id INT);
UPDATE book SET id = 1 WHERE id > 10;
- changeType: 1
diff --git a/backend/plugin/advisor/mysql/test/system_charset_allowlist.yaml b/backend/plugin/advisor/mysql/test/system_charset_allowlist.yaml
index 2d9c56fa7b..c653580385 100644
--- a/backend/plugin/advisor/mysql/test/system_charset_allowlist.yaml
+++ b/backend/plugin/advisor/mysql/test/system_charset_allowlist.yaml
@@ -1,9 +1,6 @@
- statement: CREATE TABLE t(a int) CHARSET utf8mb4;
- changeType: 1
- statement: CREATE TABLE t(a varchar(255));
- changeType: 1
- statement: CREATE TABLE t(a int) CHARSET ascii;
- changeType: 1
want:
- status: 2
code: 1001
@@ -16,7 +13,6 @@
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t CHARSET ascii;
- changeType: 1
want:
- status: 2
code: 1001
@@ -27,7 +23,6 @@
column: 0
endposition: null
- statement: ALTER DATABASE test CHARSET ascii;
- changeType: 1
want:
- status: 2
code: 1001
@@ -38,7 +33,6 @@
column: 0
endposition: null
- statement: CREATE TABLE t(a varchar(255) CHARSET ascii);
- changeType: 1
want:
- status: 2
code: 1001
@@ -51,7 +45,6 @@
- statement: |-
CREATE TABLE t(b int);
ALTER TABLE t ADD COLUMN a varchar(255) CHARSET ascii;
- changeType: 1
want:
- status: 2
code: 1001
@@ -64,7 +57,6 @@
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t MODIFY COLUMN a varchar(255) CHARSET ascii;
- changeType: 1
want:
- status: 2
code: 1001
@@ -77,7 +69,6 @@
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t CHANGE COLUMN a a varchar(255) CHARSET ascii;
- changeType: 1
want:
- status: 2
code: 1001
@@ -88,4 +79,3 @@
column: 0
endposition: null
- statement: /* this is a comment */
- changeType: 1
diff --git a/backend/plugin/advisor/mysql/test/system_collation_allowlist.yaml b/backend/plugin/advisor/mysql/test/system_collation_allowlist.yaml
index df82bc0fb9..955df88470 100644
--- a/backend/plugin/advisor/mysql/test/system_collation_allowlist.yaml
+++ b/backend/plugin/advisor/mysql/test/system_collation_allowlist.yaml
@@ -1,5 +1,4 @@
- statement: CREATE TABLE test(id INT PRIMARY KEY COMMENT 'comment',name VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'comment',room_id INT NOT NULL DEFAULT 0 COMMENT 'comment',creator_id INT NOT NULL DEFAULT 0 COMMENT 'comment',created_ts TIMESTAMP NOT NULL DEFAULT NOW() COMMENT 'comment',updater_id INT NOT NULL DEFAULT 0 COMMENT 'comment',updated_ts TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE NOW() COMMENT 'comment',INDEX idx_test_name(name),UNIQUE KEY uk_test_id_name(id, name)) ENGINE = INNODB COMMENT 'comment'
- changeType: 1
- statement: |
CREATE TABLE userTable(
id INT NOT NULL,
@@ -13,7 +12,6 @@
UNIQUE KEY uk1(id, name),
FOREIGN KEY fk1(roomId) REFERENCES room(id),
INDEX idx_userTable_content(content)) ENGINE = CSV COLLATE latin1_bin;
- changeType: 1
want:
- status: 2
code: 1201
@@ -47,9 +45,7 @@
INDEX idx_user_name(name),
UNIQUE KEY uk_user_id_name(id, name)
) ENGINE = INNODB COMMENT 'comment';
- changeType: 1
- statement: CREATE TABLE t(a int) COLLATE utf8mb4_polish_ci;
- changeType: 1
want:
- status: 2
code: 1201
@@ -60,9 +56,7 @@
column: 0
endposition: null
- statement: CREATE TABLE t(a varchar(255));
- changeType: 1
- statement: CREATE TABLE t(a int) COLLATE latin1_bin;
- changeType: 1
want:
- status: 2
code: 1201
@@ -75,7 +69,6 @@
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t COLLATE latin1_bin;
- changeType: 1
want:
- status: 2
code: 1201
@@ -86,7 +79,6 @@
column: 0
endposition: null
- statement: ALTER DATABASE test COLLATE latin1_bin;
- changeType: 1
want:
- status: 2
code: 1201
@@ -97,7 +89,6 @@
column: 0
endposition: null
- statement: CREATE TABLE t(a varchar(255) CHARACTER SET latin1 COLLATE latin1_bin);
- changeType: 1
want:
- status: 2
code: 1201
@@ -110,7 +101,6 @@
- statement: |-
CREATE TABLE t(b int);
ALTER TABLE t ADD COLUMN a varchar(255) CHARACTER SET latin1 COLLATE latin1_bin;
- changeType: 1
want:
- status: 2
code: 1201
@@ -123,7 +113,6 @@
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t MODIFY COLUMN a varchar(255) CHARACTER SET latin1 COLLATE latin1_bin;
- changeType: 1
want:
- status: 2
code: 1201
@@ -136,7 +125,6 @@
- statement: |-
CREATE TABLE t(a int);
ALTER TABLE t CHANGE COLUMN a a varchar(255) CHARACTER SET latin1 COLLATE latin1_bin;
- changeType: 1
want:
- status: 2
code: 1201
diff --git a/backend/plugin/advisor/mysql/test/system_event_disallow_create.yaml b/backend/plugin/advisor/mysql/test/system_event_disallow_create.yaml
index 1b954224f1..3310678f38 100644
--- a/backend/plugin/advisor/mysql/test/system_event_disallow_create.yaml
+++ b/backend/plugin/advisor/mysql/test/system_event_disallow_create.yaml
@@ -1,5 +1,4 @@
- statement: CREATE TABLE t(a int);
- changeType: 1
- statement: |-
CREATE EVENT daily_backup
ON SCHEDULE
@@ -9,7 +8,6 @@
INSERT INTO backup_table (backup_date, data)
SELECT NOW(), data
FROM main_table;
- changeType: 1
want:
- status: 2
code: 1501
diff --git a/backend/plugin/advisor/mysql/test/system_function_disallow_create.yaml b/backend/plugin/advisor/mysql/test/system_function_disallow_create.yaml
index d135aa18cc..979035f411 100644
--- a/backend/plugin/advisor/mysql/test/system_function_disallow_create.yaml
+++ b/backend/plugin/advisor/mysql/test/system_function_disallow_create.yaml
@@ -1,5 +1,4 @@
- statement: CREATE TABLE t(a int);
- changeType: 1
- statement: |-
CREATE FUNCTION add_two_numbers(a INT, b INT)
RETURNS INT
@@ -8,7 +7,6 @@
SET result = a + b;
RETURN result;
END;
- changeType: 1
want:
- status: 2
code: 1701
diff --git a/backend/plugin/advisor/mysql/test/system_function_disallowed_list.yaml b/backend/plugin/advisor/mysql/test/system_function_disallowed_list.yaml
index 8b1002b9a5..335030c186 100644
--- a/backend/plugin/advisor/mysql/test/system_function_disallowed_list.yaml
+++ b/backend/plugin/advisor/mysql/test/system_function_disallowed_list.yaml
@@ -1,7 +1,5 @@
- statement: CREATE TABLE t(a int);
- changeType: 1
- statement: SELECT RAND();
- changeType: 1
want:
- status: 2
code: 1702
@@ -17,7 +15,6 @@
name VARCHAR(255),
age INT
);
- changeType: 1
want:
- status: 2
code: 1702
@@ -33,7 +30,6 @@
column: 0
endposition: null
- statement: SELECT SLEEP(5);
- changeType: 1
want:
- status: 2
code: 1702
diff --git a/backend/plugin/advisor/mysql/test/system_procedure_disallow_create.yaml b/backend/plugin/advisor/mysql/test/system_procedure_disallow_create.yaml
index 56bbb2cc1d..637eb3c5bf 100644
--- a/backend/plugin/advisor/mysql/test/system_procedure_disallow_create.yaml
+++ b/backend/plugin/advisor/mysql/test/system_procedure_disallow_create.yaml
@@ -1,11 +1,9 @@
- statement: CREATE TABLE t(a int);
- changeType: 1
- statement: |-
CREATE PROCEDURE simpleProcedure()
BEGIN
SELECT 'Hello, World!' AS Message;
END;
- changeType: 1
want:
- status: 2
code: 1401
diff --git a/backend/plugin/advisor/mysql/test/system_view_disallow_create.yaml b/backend/plugin/advisor/mysql/test/system_view_disallow_create.yaml
index 029e34ca05..463134bfc8 100644
--- a/backend/plugin/advisor/mysql/test/system_view_disallow_create.yaml
+++ b/backend/plugin/advisor/mysql/test/system_view_disallow_create.yaml
@@ -1,7 +1,5 @@
- statement: CREATE TABLE t(a int);
- changeType: 1
- statement: CREATE VIEW get_one AS SELECT 1;
- changeType: 1
want:
- status: 2
code: 1601
diff --git a/backend/plugin/advisor/mysql/test/table_comment.yaml b/backend/plugin/advisor/mysql/test/table_comment.yaml
index e3ffd516ff..2b2dbc2910 100644
--- a/backend/plugin/advisor/mysql/test/table_comment.yaml
+++ b/backend/plugin/advisor/mysql/test/table_comment.yaml
@@ -1,7 +1,6 @@
- statement: |-
CREATE TABLE a(b INT) COMMENT 'table';
CREATE TABLE t(a int) COMMENT 'some comments';
- changeType: 1
want:
- status: 2
code: 1301
@@ -14,7 +13,6 @@
- statement: |-
CREATE TABLE a(b INT) COMMENT 'table';
CREATE TABLE t(a int);
- changeType: 1
want:
- status: 2
code: 1032
@@ -27,7 +25,6 @@
- statement: |-
CREATE TABLE a(b INT) COMMENT 'table';
CREATE TABLE t(a int) COMMENT 'sdlfkjalkseblkjduafelbnlsdfkljayue';
- changeType: 1
want:
- status: 2
code: 1301
diff --git a/backend/plugin/advisor/mysql/test/table_disallow_partition.yaml b/backend/plugin/advisor/mysql/test/table_disallow_partition.yaml
index ae2f39687b..de737b9318 100644
--- a/backend/plugin/advisor/mysql/test/table_disallow_partition.yaml
+++ b/backend/plugin/advisor/mysql/test/table_disallow_partition.yaml
@@ -1,12 +1,10 @@
- statement: CREATE TABLE t(a int);
- changeType: 1
- statement: |-
CREATE TABLE b(a INT);
CREATE TABLE t(a int) PARTITION BY RANGE (a) (
PARTITION p0 VALUES LESS THAN (6),
PARTITION p1 VALUES LESS THAN (11)
);
- changeType: 1
want:
- status: 2
code: 608
@@ -25,7 +23,6 @@
PARTITION p0 VALUES LESS THAN (6),
PARTITION p1 VALUES LESS THAN (11)
);
- changeType: 1
want:
- status: 2
code: 608
@@ -48,7 +45,6 @@
PARTITION p0 VALUES LESS THAN (6),
PARTITION p1 VALUES LESS THAN (11)
);
- changeType: 1
want:
- status: 2
code: 608
diff --git a/backend/plugin/advisor/mysql/test/table_disallow_set_charset.yaml b/backend/plugin/advisor/mysql/test/table_disallow_set_charset.yaml
index 13b58d390a..627c4c4876 100644
--- a/backend/plugin/advisor/mysql/test/table_disallow_set_charset.yaml
+++ b/backend/plugin/advisor/mysql/test/table_disallow_set_charset.yaml
@@ -3,7 +3,6 @@
id INT PRIMARY KEY,
name VARCHAR(50)
) CHARSET=utf8;
- changeType: 1
want:
- status: 2
code: 612
@@ -23,7 +22,6 @@
name VARCHAR(50)
);
ALTER TABLE employee CONVERT TO CHARACTER SET utf8;
- changeType: 1
want:
- status: 2
code: 612
diff --git a/backend/plugin/advisor/mysql/test/table_disallow_trigger.yaml b/backend/plugin/advisor/mysql/test/table_disallow_trigger.yaml
index 0a10ad5c92..4c236aae34 100644
--- a/backend/plugin/advisor/mysql/test/table_disallow_trigger.yaml
+++ b/backend/plugin/advisor/mysql/test/table_disallow_trigger.yaml
@@ -1,10 +1,8 @@
- statement: CREATE TABLE t(a int);
- changeType: 1
- statement: |-
CREATE TABLE account (acct_num INT, amount DECIMAL(10,2));
CREATE TRIGGER ins_sum BEFORE INSERT ON account
FOR EACH ROW SET @sum = @sum + NEW.amount;
- changeType: 1
want:
- status: 2
code: 610
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 2bd947ab21..f7b4cc5bd9 100644
--- a/backend/plugin/advisor/mysql/test/table_drop_naming_convention.yaml
+++ b/backend/plugin/advisor/mysql/test/table_drop_naming_convention.yaml
@@ -2,11 +2,9 @@
CREATE TABLE foo(a INT);
RENAME TABLE foo to foo_delete;
DROP TABLE IF EXISTS foo_delete;
- changeType: 1
- statement: |-
CREATE TABLE foo(a INT);
DROP TABLE IF EXISTS foo;
- changeType: 1
want:
- status: 2
code: 603
@@ -21,7 +19,6 @@
RENAME TABLE foo to foo_delete;
CREATE TABLE bar(a INT);
DROP TABLE IF EXISTS foo_delete, bar;
- changeType: 1
want:
- status: 2
code: 603
diff --git a/backend/plugin/advisor/mysql/test/table_no_duplicate_index.yaml b/backend/plugin/advisor/mysql/test/table_no_duplicate_index.yaml
index 0995e89759..64b14f9c23 100644
--- a/backend/plugin/advisor/mysql/test/table_no_duplicate_index.yaml
+++ b/backend/plugin/advisor/mysql/test/table_no_duplicate_index.yaml
@@ -7,7 +7,6 @@
INDEX idx_email (email),
INDEX idx_name (last_name, first_name)
);
- changeType: 1
- statement: |-
CREATE TABLE orders (
id INT PRIMARY KEY,
@@ -17,7 +16,6 @@
INDEX (order_number),
UNIQUE (customer_id)
);
- changeType: 1
- statement: |-
CREATE TABLE users (
id INT PRIMARY KEY,
@@ -27,7 +25,6 @@
INDEX idx_email (email),
INDEX idx_username_duplicate (username)
);
- changeType: 1
want:
- status: 2
code: 815
@@ -46,7 +43,6 @@
INDEX (order_number),
INDEX (customer_id)
);
- changeType: 1
want:
- status: 2
code: 815
@@ -66,7 +62,6 @@
FOREIGN KEY (customer_id) REFERENCES customers(id)
);
ALTER TABLE orders ADD INDEX idx_duplicate (customer_id);
- changeType: 1
want:
- status: 2
code: 815
@@ -84,7 +79,6 @@
);
CREATE INDEX idx_customer_id ON orders (customer_id);
CREATE INDEX idx_customer_id_duplicate ON orders (customer_id);
- changeType: 1
want:
- status: 2
code: 815
@@ -102,7 +96,6 @@
);
CREATE INDEX idx_customer ON orders (customer, (order_number * 2));
CREATE INDEX idx_customer_duplicate ON orders (customer, (order_number * 2));
- changeType: 1
want:
- status: 2
code: 815
@@ -120,7 +113,6 @@
);
CREATE INDEX idx_customer_btree USING BTREE ON orders (customer);
CREATE INDEX idx_customer_hash USING HASH ON orders (customer);
- changeType: 1
- statement: |-
CREATE TABLE orders_sh (
id INT PRIMARY KEY,
@@ -134,4 +126,3 @@
customer VARCHAR(50)
);
CREATE INDEX idx_customer_bj ON orders_bj (customer);
- changeType: 1
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 3e483ac03f..c5cbe6391d 100644
--- a/backend/plugin/advisor/mysql/test/table_no_foreign_key.yaml
+++ b/backend/plugin/advisor/mysql/test/table_no_foreign_key.yaml
@@ -1,7 +1,6 @@
- statement: |-
CREATE TABLE book(id INT);
ALTER TABLE tech_book ADD CONSTRAINT fk_tech_book_author_id_author_id FOREIGN KEY (author_id) REFERENCES author (id);
- changeType: 1
want:
- status: 2
code: 602
@@ -14,7 +13,6 @@
- statement: |-
CREATE TABLE t1 (id INT);
CREATE TABLE book(id INT, author_id INT, FOREIGN KEY fk_book_author_id_author_id (author_id) REFERENCES author (id));
- changeType: 1
want:
- status: 2
code: 602
diff --git a/backend/plugin/advisor/mysql/test/table_require_pk.yaml b/backend/plugin/advisor/mysql/test/table_require_pk.yaml
index 982d9c6490..484efc2304 100644
--- a/backend/plugin/advisor/mysql/test/table_require_pk.yaml
+++ b/backend/plugin/advisor/mysql/test/table_require_pk.yaml
@@ -11,7 +11,6 @@
UNIQUE KEY uk1(id, name),
FOREIGN KEY fk1(roomId) REFERENCES room(id),
INDEX idx_userTable_content(content)) ENGINE = CSV COLLATE latin1_bin;
- changeType: 1
want:
- status: 2
code: 601
@@ -33,12 +32,10 @@
INDEX idx_user_name(name),
UNIQUE KEY uk_user_id_name(id, name)
) ENGINE = INNODB COMMENT 'comment';
- changeType: 1
- statement: |
CREATE TABLE t1(id INT PRIMARY KEY);
CREATE TABLE t2(id INT);
ALTER TABLE t2 ADD UNIQUE INDEX uk (id);
- changeType: 1
want:
- status: 2
code: 601
@@ -52,7 +49,6 @@
CREATE TABLE t1(id INT, PRIMARY KEY (id));
CREATE TABLE t2(id INT);
ALTER TABLE t2 ADD COLUMN uid INT UNIQUE KEY;
- changeType: 1
want:
- status: 2
code: 601
@@ -65,12 +61,10 @@
- statement: |-
CREATE TABLE t1(id INT PRIMARY KEY);
CREATE TABLE t2(id INT, PRIMARY KEY (id));
- changeType: 1
- statement: |-
CREATE TABLE t1(id INT PRIMARY KEY);
CREATE TABLE t2(id INT);
DROP TABLE t1;
- changeType: 1
want:
- status: 2
code: 601
@@ -85,15 +79,12 @@
CREATE TABLE t2(id INT);
DROP TABLE t1;
DROP TABLE t2;
- changeType: 1
- statement: |-
CREATE TABLE t(id INT);
ALTER TABLE t ADD CONSTRAINT PRIMARY KEY (id);
- changeType: 1
- statement: |-
CREATE TABLE t(id INT PRIMARY KEY);
ALTER TABLE t DROP PRIMARY KEY;
- changeType: 1
want:
- status: 2
code: 601
@@ -106,7 +97,6 @@
- statement: |-
CREATE TABLE t(id INT PRIMARY KEY);
ALTER TABLE t DROP INDEX `PRIMARY`;
- changeType: 1
want:
- status: 2
code: 601
@@ -119,28 +109,21 @@
- statement: |-
CREATE TABLE t(id INT);
ALTER TABLE t ADD COLUMN name varchar(30) PRIMARY KEY;
- changeType: 1
- statement: |-
CREATE TABLE t(id INT);
ALTER TABLE t CHANGE COLUMN id id INT PRIMARY KEY;
- changeType: 1
- statement: ALTER TABLE tech_book CHANGE COLUMN id uid INT;
- changeType: 1
- statement: |-
CREATE TABLE t(id INT);
ALTER TABLE t MODIFY COLUMN id INT PRIMARY KEY;
- changeType: 1
- statement: ALTER TABLE tech_book MODIFY COLUMN id INT;
- changeType: 1
- statement: |-
CREATE TABLE t(id INT, name varchar(30), PRIMARY KEY(id, name));
ALTER TABLE t DROP COLUMN id;
- changeType: 1
- statement: |-
CREATE TABLE t(id INT, name varchar(30), comment varchar(255), PRIMARY KEY(id, name));
ALTER TABLE t ADD COLUMN age INT;
ALTER TABLE t DROP COLUMN id, DROP COLUMN name;
- changeType: 1
want:
- status: 2
code: 601
@@ -153,7 +136,6 @@
- statement: |-
ALTER TABLE tech_book ADD COLUMN c INT;
ALTER TABLE tech_book ADD COLUMN a int, DROP COLUMN id, DROP COLUMN name;
- changeType: 1
want:
- status: 2
code: 601
@@ -164,11 +146,9 @@
column: 0
endposition: null
- statement: ALTER TABLE tech_book DROP COLUMN name;
- changeType: 1
- statement: |-
ALTER TABLE tech_book ADD COLUMN c INT;
ALTER TABLE tech_book DROP COLUMN name, DROP COLUMN id;
- changeType: 1
want:
- status: 2
code: 601
@@ -181,7 +161,6 @@
- statement: |-
ALTER TABLE tech_book CHANGE COLUMN id uid int;
ALTER TABLE tech_book ADD COLUMN a int, DROP COLUMN uid, DROP COLUMN name;
- changeType: 1
want:
- status: 2
code: 601
diff --git a/backend/plugin/parser/mysql/mysql.go b/backend/plugin/parser/mysql/mysql.go
index 483de01432..8eb5bd5b9a 100644
--- a/backend/plugin/parser/mysql/mysql.go
+++ b/backend/plugin/parser/mysql/mysql.go
@@ -1,13 +1,15 @@
package mysql
import (
+ "errors"
+ "fmt"
"regexp"
"strings"
- "github.com/pkg/errors"
-
"github.com/antlr4-go/antlr/v4"
+ mysqlomniparser "github.com/bytebase/omni/mysql/parser"
parser "github.com/bytebase/parser/mysql"
+ pkgerrors "github.com/pkg/errors"
storepb "github.com/bytebase/bytebase/backend/generated-go/store"
"github.com/bytebase/bytebase/backend/plugin/parser/base"
@@ -32,29 +34,62 @@ func parseMySQLStatements(statement string) ([]base.ParsedStatement, error) {
return nil, err
}
- // Parse using the pre-split statements to avoid double-splitting
- parseResults, err := parseMySQLStatementsInternal(stmts)
- if err != nil {
- return nil, err
- }
-
- // Combine: Statement provides text/positions, ANTLRAST provides AST
var result []base.ParsedStatement
- astIndex := 0
for _, stmt := range stmts {
- ps := base.ParsedStatement{
- Statement: stmt,
+ if stmt.Empty {
+ continue
}
- if !stmt.Empty && astIndex < len(parseResults) {
- ps.AST = parseResults[astIndex]
- astIndex++
+
+ list, omniErr := ParseMySQLOmni(stmt.Text)
+ if omniErr != nil {
+ return nil, convertOmniError(omniErr, stmt)
+ }
+
+ if list == nil || len(list.Items) == 0 {
+ continue
+ }
+
+ for _, node := range list.Items {
+ result = append(result, base.ParsedStatement{
+ Statement: stmt,
+ AST: &OmniAST{
+ Node: node,
+ Text: stmt.Text,
+ StartPosition: stmt.Start,
+ },
+ })
}
- result = append(result, ps)
}
return result, nil
}
+// convertOmniError converts an omni parser error to a base.SyntaxError with proper line:column position.
+func convertOmniError(err error, stmt base.Statement) error {
+ var parseErr *mysqlomniparser.ParseError
+ if !errors.As(err, &parseErr) {
+ return err
+ }
+
+ pos := ByteOffsetToRunePosition(stmt.Text, parseErr.Position)
+
+ // Adjust line by the statement's base line (stmt.Start.Line is 1-based).
+ if stmt.Start != nil {
+ pos.Line += stmt.Start.Line - 1
+ }
+
+ msg := fmt.Sprintf("Syntax error at line %d:%d: %s", pos.Line, pos.Column, parseErr.Message)
+ if parseErr.RelatedText != "" {
+ msg += "\nrelated text: " + parseErr.RelatedText
+ }
+
+ return &base.SyntaxError{
+ Position: pos,
+ Message: msg,
+ RawMessage: parseErr.Message,
+ }
+}
+
// ParseMySQL parses the given SQL statement and returns the AST.
func ParseMySQL(statement string) ([]*base.ANTLRAST, error) {
statement, err := DealWithDelimiter(statement)
@@ -176,6 +211,22 @@ func parseSingleStatement(baseLine int, statement string) (antlr.Tree, *antlr.Co
return tree, stream, nil
}
+// parseSingleStatementLenient parses a single MySQL statement with ANTLR in error-recovery mode
+// (no error listeners). Used by OmniAST.AsANTLRAST() for backward-compatible tree walking.
+func parseSingleStatementLenient(statement string) (antlr.Tree, *antlr.CommonTokenStream) {
+ statement = mysqlAddSemicolonIfNeeded(statement)
+ input := antlr.NewInputStream(statement)
+ lexer := parser.NewMySQLLexer(input)
+ stream := antlr.NewCommonTokenStream(lexer, antlr.TokenDefaultChannel)
+
+ p := parser.NewMySQLParser(stream)
+ p.RemoveErrorListeners()
+ p.BuildParseTrees = true
+
+ tree := p.Script()
+ return tree, stream
+}
+
func mysqlAddSemicolonIfNeeded(sql string) string {
lexer := parser.NewMySQLLexer(antlr.NewInputStream(sql))
lexerErrorListener := &base.ParseErrorListener{
@@ -234,7 +285,7 @@ func ExtractDelimiter(stmt string) (string, error) {
if index >= 0 && index < len(matchList) {
return matchList[index], nil
}
- return "", errors.Errorf("cannot extract delimiter from %q", stmt)
+ return "", pkgerrors.Errorf("cannot extract delimiter from %q", stmt)
}
func hasDelimiter(statement string) (bool, []base.Statement, error) {
@@ -242,7 +293,7 @@ func hasDelimiter(statement string) (bool, []base.Statement, error) {
t := tokenizer.NewTokenizer(statement)
list, err := t.SplitTiDBMultiSQL()
if err != nil {
- return false, nil, errors.Errorf("failed to split multi sql: %v", err)
+ return false, nil, pkgerrors.Errorf("failed to split multi sql: %v", err)
}
for _, sql := range list {
diff --git a/backend/plugin/parser/mysql/omni.go b/backend/plugin/parser/mysql/omni.go
new file mode 100644
index 0000000000..f5535d83b1
--- /dev/null
+++ b/backend/plugin/parser/mysql/omni.go
@@ -0,0 +1,101 @@
+package mysql
+
+import (
+ "unicode/utf8"
+
+ "github.com/bytebase/omni/mysql/ast"
+ mysqlparser "github.com/bytebase/omni/mysql/parser"
+
+ storepb "github.com/bytebase/bytebase/backend/generated-go/store"
+ "github.com/bytebase/bytebase/backend/plugin/parser/base"
+)
+
+// OmniAST wraps an omni AST node and implements the base.AST interface.
+// During migration, it also implements AntlrASTProvider so that callers
+// still using GetANTLRAST() can fall back to the ANTLR tree.
+type OmniAST struct {
+ // Node is the omni AST node (e.g. *ast.SelectStmt, *ast.CreateTableStmt).
+ Node ast.Node
+ // Text is the original SQL text of this statement.
+ Text string
+ // StartPosition is the 1-based position where this statement starts.
+ StartPosition *storepb.Position
+
+ // antlrAST is lazily populated when AsANTLRAST() is called.
+ // This field will be removed once all callers are migrated to omni.
+ antlrAST *base.ANTLRAST
+ // antlrParsed tracks whether we've attempted the ANTLR parse.
+ antlrParsed bool
+}
+
+// ASTStartPosition implements base.AST.
+func (a *OmniAST) ASTStartPosition() *storepb.Position {
+ return a.StartPosition
+}
+
+// AsANTLRAST implements base.AntlrASTProvider for backward compatibility.
+// It lazily parses the SQL text with the ANTLR parser and caches the result.
+// This will be removed once all MySQL modules are migrated to omni.
+func (a *OmniAST) AsANTLRAST() (*base.ANTLRAST, bool) {
+ if a.antlrParsed {
+ return a.antlrAST, a.antlrAST != nil
+ }
+ a.antlrParsed = true
+
+ // Use lenient ANTLR parsing (no error listeners) since omni already
+ // validated the SQL. The ANTLR tree is only needed for backward-compatible
+ // tree walking by callers that haven't migrated to omni yet.
+ tree, tokens := parseSingleStatementLenient(a.Text)
+ a.antlrAST = &base.ANTLRAST{
+ StartPosition: a.StartPosition,
+ Tree: tree,
+ Tokens: tokens,
+ }
+ return a.antlrAST, true
+}
+
+// ParseMySQLOmni parses SQL using omni's parser and returns an ast.List.
+// This is the recommended entry point for new code that needs omni AST nodes.
+func ParseMySQLOmni(sql string) (*ast.List, error) {
+ return mysqlparser.Parse(sql)
+}
+
+// GetOmniNode extracts the omni AST node from a base.AST interface.
+// Returns the node and true if it is an OmniAST, nil and false otherwise.
+func GetOmniNode(a base.AST) (ast.Node, bool) {
+ if a == nil {
+ return nil, false
+ }
+ omniAST, ok := a.(*OmniAST)
+ if !ok {
+ return nil, false
+ }
+ return omniAST.Node, true
+}
+
+// ByteOffsetToRunePosition converts a byte offset in sql to a 1-based line:column
+// where column is measured in Unicode code points (runes), matching storepb.Position semantics.
+func ByteOffsetToRunePosition(sql string, byteOffset int) *storepb.Position {
+ if byteOffset > len(sql) {
+ byteOffset = len(sql)
+ }
+
+ line := int32(1)
+ runeCol := int32(0) // 0-based rune count on current line
+ i := 0
+ for i < byteOffset {
+ r, size := utf8.DecodeRuneInString(sql[i:])
+ if r == '\n' {
+ line++
+ runeCol = 0
+ } else {
+ runeCol++
+ }
+ i += size
+ }
+
+ return &storepb.Position{
+ Line: line,
+ Column: runeCol + 1, // convert to 1-based
+ }
+}
diff --git a/backend/plugin/schema/mysql/testdata/walk_through.yaml b/backend/plugin/schema/mysql/testdata/walk_through.yaml
index 1a9bc36b0e..772b9b9f6b 100644
--- a/backend/plugin/schema/mysql/testdata/walk_through.yaml
+++ b/backend/plugin/schema/mysql/testdata/walk_through.yaml
@@ -433,8 +433,7 @@
- statement: "create table all_types(\n c1 tinyblob not null,\n c2 blob not null,\n\
\ c3 mediumblob not null,\n c4 longblob not null,\n c5 tinytext not null,\n\
\ c6 text not null,\n c7 mediumtext not null,\n c8 longtext not null,\n c9\
- \ json not null,\n c10 serial not null,\n c11 long varbinary not null,\n c12\
- \ long varchar not null \n);"
+ \ json not null,\n c10 serial not null\n);"
ignore_case_sensitive: false
want: "{\n \"name\": \"test\",\n \"schemas\": [\n {\n \"tables\": [\n\
\ {\n \"name\": \"all_types\",\n \"columns\": [\n \
@@ -455,9 +454,5 @@
\ \"name\": \"c9\",\n \"position\": 9,\n \"type\"\
: \"json\"\n },\n {\n \"name\": \"c10\",\n\
\ \"position\": 10,\n \"type\": \"serial\"\n \
- \ },\n {\n \"name\": \"c11\",\n \"position\"\
- : 11,\n \"type\": \"long\"\n },\n {\n \
- \ \"name\": \"c12\",\n \"position\": 12,\n \"\
- type\": \"long\"\n }\n ]\n }\n ]\n }\n ]\n\
- }"
+ \ }\n ]\n }\n ]\n }\n ]\n}"
advice: null
diff --git a/backend/tests/test-data/sql_review_mysql.yaml b/backend/tests/test-data/sql_review_mysql.yaml
index 3ccfc49207..16f45d711d 100644
--- a/backend/tests/test-data/sql_review_mysql.yaml
+++ b/backend/tests/test-data/sql_review_mysql.yaml
@@ -12,7 +12,7 @@
{
"status": "ERROR",
"title": "Syntax error",
- "content": "Syntax error at line 1:21 \nrelated text: CREATE TABLE user(id)",
+ "content": "Syntax error at line 1:21: expected data type\nrelated text: CREATE TABLE user(id);",
"code": 201,
"sqlReviewReport": {
"startPosition": {
diff --git a/go.mod b/go.mod
index 97b59c3e7a..3f203ae26c 100644
--- a/go.mod
+++ b/go.mod
@@ -34,7 +34,7 @@ require (
github.com/bmatcuk/doublestar/v4 v4.10.0
github.com/bytebase/gomongo v0.0.0-20260324061529-f15b9a5add35
github.com/bytebase/lsp-protocol v0.0.0-20250324071136-1586d0c10ff0
- github.com/bytebase/omni v0.0.0-20260331094502-07f157a265aa
+ github.com/bytebase/omni v0.0.0-20260402092952-d5ff8b1753d6
github.com/caarlos0/env/v11 v11.4.0
github.com/cenkalti/backoff/v5 v5.0.3
github.com/cockroachdb/cockroachdb-parser v0.25.2
diff --git a/go.sum b/go.sum
index 4bf03161d2..d327525adf 100644
--- a/go.sum
+++ b/go.sum
@@ -253,8 +253,8 @@ github.com/bytebase/gomongo v0.0.0-20260324061529-f15b9a5add35 h1:SjcZSrUMNj6GZq
github.com/bytebase/gomongo v0.0.0-20260324061529-f15b9a5add35/go.mod h1:jHdAD+tN3bO2Hazme0crgkNiHqkDR/3Igesy1chhjLA=
github.com/bytebase/lsp-protocol v0.0.0-20250324071136-1586d0c10ff0 h1:bJ8NSf2K+pccl5m/wuu97fiYjDwpJH6IzURAq/3XA2U=
github.com/bytebase/lsp-protocol v0.0.0-20250324071136-1586d0c10ff0/go.mod h1:BEWMfiZtqshdmulKJcIsWb45MUaEvDO4CROcgi8dfFg=
-github.com/bytebase/omni v0.0.0-20260331094502-07f157a265aa h1:o1a+V1HLaXt/Rv2atFZaEQv2+YoZrimKHvC0BUgKN6I=
-github.com/bytebase/omni v0.0.0-20260331094502-07f157a265aa/go.mod h1:7kUVQrivlkckALafCX5j4W3M95Cg9+Kw69ZukIHKXhQ=
+github.com/bytebase/omni v0.0.0-20260402092952-d5ff8b1753d6 h1:WwcxIkyoV4kugHcebFxDucHCnSsSgGZl04WbkJRV9l4=
+github.com/bytebase/omni v0.0.0-20260402092952-d5ff8b1753d6/go.mod h1:7kUVQrivlkckALafCX5j4W3M95Cg9+Kw69ZukIHKXhQ=
github.com/bytebase/parser v0.0.0-20260324092042-1d52e5412f50 h1:Kq5wlhZ586Rch39y/IQV9MnrEzHob4iiXBG6zrbvSMU=
github.com/bytebase/parser v0.0.0-20260324092042-1d52e5412f50/go.mod h1:jeak/EfutSOAuWKvrFIT2IZunhWprM7oTFBRgZ9RCxo=
github.com/bytebase/pgx/v5 v5.0.0-20250212161523-96ff8aed8767 h1:YuR5G3LcxpO5ScSTA+Kdirxg9RW4TRc/v1t7N2Hfmbw=
@@ -999,6 +999,8 @@ github.com/testcontainers/testcontainers-go v0.41.0 h1:mfpsD0D36YgkxGj2LrIyxuwQ9
github.com/testcontainers/testcontainers-go v0.41.0/go.mod h1:pdFrEIfaPl24zmBjerWTTYaY0M6UHsqA1YSvsoU40MI=
github.com/testcontainers/testcontainers-go/modules/mongodb v0.40.0 h1:z/1qHeliTLDKNaJ7uOHOx1FjwghbcbYfga4dTFkF0hU=
github.com/testcontainers/testcontainers-go/modules/mongodb v0.40.0/go.mod h1:GaunAWwMXLtsMKG3xn2HYIBDbKddGArfcGsF2Aog81E=
+github.com/testcontainers/testcontainers-go/modules/mysql v0.41.0 h1:5rwejaJr5nIfw8NK99eKPX7O6k27lnSMklTj5DbYybM=
+github.com/testcontainers/testcontainers-go/modules/mysql v0.41.0/go.mod h1:iMO/aFWnbjYkqHw8VPsJB3rVTOD9hKDsUtV0PvzD0DA=
github.com/testcontainers/testcontainers-go/modules/postgres v0.41.0 h1:AOtFXssrDlLm84A2sTTR/AhvJiYbrIuCO59d+Ro9Tb0=
github.com/testcontainers/testcontainers-go/modules/postgres v0.41.0/go.mod h1:k2a09UKhgSp6vNpliIY0QSgm4Hi7GXVTzWvWgUemu/8=
github.com/the42/cartconvert v0.0.0-20131203171324-aae784c392b8 h1:I4DY8wLxJXCrMYzDM6lKCGc3IQwJX0PlTLsd3nQqI3c=