You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature Request]: DDL Transfer tool from MySQL to MO #4374
Is there an existing issue for the same feature request?
I have checked the existing issues.
Is your feature request related to a problem?
No response
Describe the feature you'd like
Please provide a tool including these features
a. Input DDL statements from mysqldump then it will be transferred a runnable one in MO.
b. Support a parameter for case sensitive. Users can decide whether the transferred DDL to be case sensitive or not.
Describe implementation you've considered
No response
Documentation, Adoption, Use Case, Migration Strategy
common test case: 36 cases are designed and tested, with 100% passed, 0% failed
customer test case: 11 datasets tested, with 9 passed and 2 failed. ( see moc 1180 and 1181 )
Appendix:
common test case - test.sql
-- 1. /*! */ /* */-- test_001: succeeded/*!40101 -- SET @saved_cs_client = @@character_set_client */;
-- test_002: succeeded/*!40101 -- SET character_set_client = utf8 */;
-- test_003: succeeded/*!40000 create database if not exists db_1 */;
-- test_004: succeeded/*!40000 show tables in db_1 */;
-- test_005: succeeded/* this is a comment *//* and this is also a coment */-- test_006: succeededdropdatabase/*!40000 if exists */ test2;
-- test_007: succeededdropdatabase if exists test;
create database /* this is another comment */ if not exists test;
select database();
/*!40101 use test; */select database();
-- 2. ENGINE=xxx (InnoDB, MyISAM, ...)-- test_008: succeededcreatetableif not exists t1(
id int, name varchar(255)
) engine ='InnoDB';
-- 3. DEFAULT CHARSET=xxx (latin1, utf8, ...) COLLATE=utf8mb4_general_ci -- test_009: succeededcreatetableif not exists t2(
id int, name varchar(255)
) DEFAULT CHARSET=utf8 COLLATE = utf8mb4_general_ci ;
-- test_010: succeededcreatetableif not exists t3(
id int, name varchar(255)
) DEFAULT CHARSET = utf8;
-- test_011: succeededcreatetableif not exists t4(
id int, name varchar(255)
) DEFAULT CHARSET= utf8;
-- test_012: succeededcreatetableif not exists t5(
id int, name varchar(255)
) DEFAULT CHARSET =utf8;
-- test_013: succeededcreatetableif not exists t6(
id int, name varchar(255)
) DEFAULT CHARSET = utf8 COLLATE=utf8mb4_general_ci ;
-- 4. CHARACTER SET xxx (utf8, ...) COLLATE utf8mb4_general_ci-- test_014: succeededcreatetableif not exists t7(
id int,
name varchar(255) CHARACTER SET utf8 COLLATE utf8mb4_general_ci
);
-- test_015: succeededcreatetableif not exists t8(
id int,
name varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
);
-- 5. USING xxx (BTREE, HASH, ...)-- test_016: succeededcreatetableif not exists t9(
id int,
name varchar(255),
primary key (id) USING BTREE
);
-- 6. UNLOCK TABLES and LOCK TABLES-- test_017: succeededcreatetablet10 (id int);
LOCK TABLES t10 WRITE;
altertable t10 add column class varchar(50);
UNLOCK TABLES;
-- 7. AUTO_INCREMENT=xxx, AUTO_INCREMENT xxx-- test_018: succeededcreatetablet11 (id int AUTO_INCREMENT);
-- test_019: succeededcreatetablet12 (id int) AUTO_INCREMENT =157472;
-- test_020: succeededcreatetablet13 (id int AUTO_INCREMENT)
AUTO_INCREMENT =157472;
-- 8. ROW_FORMAT=xxx (COMPACT)-- test_021: succeededcreatetablet14 (id int)
ROW_FORMAT=DYNAMIC;
-- test_022: succeededcreatetablet15 (id int)
ROW_FORMAT = COMPACT;
-- 9. SET @saved_cs_client = xxx-- test_023: succeededSET @saved_cs_client = xxx;
-- 10. SET character_set_client = xxx-- test_024: failed-- succeededSET character_set_client = xxx;
-- failedSET @MYSQLDUMP_TEMP_LOG_BIN = @@SESSION.SQL_LOG_BIN;
-- 11. ALTER TABLE in /*!xx xx */-- test_025: succeededcreatetablet16 (id int);
show create table t16;
/*!40000 ALTER TABLE t16 add column id2 int */;
show create table t16;
-- 12. CREATE VIEW with definer-- test_026: succeededcreatetablet17(id int);
/*!50001 DROP VIEW IF EXISTS v1 */;
/*!50001 CREATE DEFINER = `root`@`%` VIEW v1 AS Select id from t17 */;
show create view v1;
-- 13. ENUM type-- test_027: succeededcreatetablet18 (id int, gender enum('male', 'female'));
-- test_028: succeededcreatetablet19 (id int, gender enum('male', 'female') NOT NULL);
-- test_030: failed-- issue: https://github.com/matrixorigin/MO-Cloud/issues/1181createtablet19 (id int, gender enum('male', 'female') default 'male');
-- test_031: failed-- issue: https://github.com/matrixorigin/MO-Cloud/issues/1181CREATETABLE `t20` (id int, gender enum('male', 'female') NOT NULL default 'male');
-- 14. partition by-- test_032: succeededCREATETABLEt21 (
`created_at` datetime NOT NULL COMMENT 'create time')
/*!50100 PARTITION BY RANGE (TO_DAYS(created_at))(PARTITION p20221109 VALUES LESS THAN (738855) ENGINE = InnoDB, PARTITION p20221208 VALUES LESS THAN (738862) ENGINE = InnoDB, PARTITION p20221209 VALUES LESS THAN (738863) ENGINE = InnoDB, PARTITION p20221210 VALUES LESS THAN (738864) ENGINE = InnoDB, PARTITION p20221211 VALUES LESS THAN (738865) ENGINE = InnoDB, PARTITION p20221212 VALUES LESS THAN (738866) ENGINE = InnoDB, PARTITION p20221213 VALUES LESS THAN (738867) ENGINE = InnoDB, PARTITION p20221214 VALUES LESS THAN (738868) ENGINE = InnoDB) */;
show create table t21;
-- test_033: succeededCREATETABLEt22 (
`created_at` datetime NOT NULL COMMENT 'create time')
PARTITION BY RANGE (TO_DAYS(created_at))
(PARTITION p20221109 VALUES LESS THAN (738855) ENGINE = InnoDB,
PARTITION p20221208 VALUES LESS THAN (738862) ENGINE = InnoDB,
PARTITION p20221209 VALUES LESS THAN (738863) ENGINE = InnoDB,
PARTITION p20221210 VALUES LESS THAN (738864) ENGINE = InnoDB,
PARTITION p20221211 VALUES LESS THAN (738865) ENGINE = InnoDB,
PARTITION p20221212 VALUES LESS THAN (738866) ENGINE = InnoDB,
PARTITION p20221213 VALUES LESS THAN (738867) ENGINE = InnoDB,
PARTITION p20221214 VALUES LESS THAN (738868) ENGINE = InnoDB);
show create table t22;
-- 15. Unused function, like "CONVERT"-- test_034: succeededCREATETABLEt23 (id int, name varchar(50));
insert into t23 values(1,'ashley'),(2,'ben'),(3,'cindy');
select*from t23;
CREATEVIEWv2ASselectconvert(`t23`.`name` using utf8mb4) as converted_name from t23;
SHOW CREATE VIEW v2;
select*from v2;
-- 16. Numeric-- test_035: succeededCREATETABLEt24 (id int, score_1 decimal(15,2), score_2 numeric(15,2), score_3 numeric);
Insert into t24 values(1, '90.34', '80.32', '80.2222');
select*from t24;
-- 99. Combination-- test_099: succeededcreatetableif not exists t99(
id int AUTO_INCREMENT,
name varchar(255) CHARACTER SET utf8 COLLATE utf8mb4_general_ci,
primary key (id) USING BTREE
) AUTO_INCREMENT=123 engine ='InnoDB' DEFAULT CHARSET=utf8 COLLATE = utf8mb4_general_ci ROW_FORMAT = COMPACT;
Activity
LiSong0214 commentedon Sep 20, 2022
create_timetimestamp(3) NOT NULL DEFAULT (3) (3) COMMENT '视频创建时间戳',daviszhen commentedon Nov 28, 2022
moved from 0.6. it is not in 0.7's plan.
florashi181 commentedon Jan 4, 2023
need to be comprehensive reviewed in 0.8.
22 remaining items
dengn commentedon Jul 10, 2023
Doc side will have concern about the corner case covered.
domingozhang commentedon Jul 28, 2023
following cases can be passed:
YANGGMM commentedon Aug 16, 2023
enum type now just support compare with string type like this:

plz care about it.
aronchanisme commentedon Aug 16, 2023
As per discussed, dev is done, hence moving to testing now
aronchanisme commentedon Aug 16, 2023
Appendix:
common test case - test.sql
lacrimosaprinz commentedon Aug 19, 2023
docs edited:matrixorigin/matrixorigin.io.cn#663
matrixorigin/matrixorigin.io#506
aronchanisme commentedon Sep 4, 2023
Test done. Back to @domingozhang
https://doc.weixin.qq.com/sheet/e3_AfsAgAbcAMIX4ez0gmnT1aPUAwfha?scode=AJsA6gc3AA8h5qt8MzAfsAgAbcAMI&tab=ro5oys