Skip to content

[Feature Request]: DDL Transfer tool from MySQL to MO #4374

Closed

Description

@domingozhang

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

No response

Additional information

No response

Activity

  1. added
    priority/p1
    source/on-demand
    on Aug 4, 2022
  2. added this to the v0.6.0 milestone on Aug 4, 2022
  3. LiSong0214 commented on Sep 20, 2022

    @LiSong0214

    create_time timestamp(3) NOT NULL DEFAULT (3) (3) COMMENT '视频创建时间戳',

  4. modified the milestones: v0.6.0, v0.7.0 on Nov 28, 2022
  5. daviszhen commented on Nov 28, 2022

    @daviszhen
    Contributor

    moved from 0.6. it is not in 0.7's plan.

  6. florashi181 commented on Jan 4, 2023

    @florashi181
    Contributor

    need to be comprehensive reviewed in 0.8.

  7. 22 remaining items

  8. dengn commented on Jul 10, 2023

    @dengn
    Contributor

    Doc side will have concern about the corner case covered.

  9. domingozhang commented on Jul 28, 2023

    @domingozhang
    ContributorAuthor

    following cases can be passed:

    1. Alter table
    2. set variables
    3. use statement with hint
    4. parition statement
    5. storage engine related
    6. unused functions in MO syntax
    7. create view with definer
    8. enum type
    9. numeric synonym
  10. removed
    attention/needs-doc-discussion
    on Aug 1, 2023
  11. YANGGMM commented on Aug 16, 2023

    @YANGGMM
    Contributor

    enum type now just support compare with string type like this:
    image

    plz care about it.

  12. aronchanisme commented on Aug 16, 2023

    @aronchanisme
    Contributor

    As per discussed, dev is done, hence moving to testing now

  13. aronchanisme commented on Aug 16, 2023

    @aronchanisme
    Contributor
    1. common test case: 36 cases are designed and tested, with 100% passed, 0% failed
    2. 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: succeeded
    drop database /*!40000 if exists */ test2;
    -- test_007: succeeded
    drop database 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: succeeded
    create table if not exists t1(
        id int, name varchar(255)
    ) engine = 'InnoDB';
    
    -- 3. DEFAULT CHARSET=xxx (latin1, utf8, ...) COLLATE=utf8mb4_general_ci 
    
    -- test_009: succeeded
    create table if not exists t2(
        id int, name varchar(255)
    ) DEFAULT CHARSET=utf8 COLLATE = utf8mb4_general_ci ;
    
    -- test_010: succeeded
    create table if not exists t3(
        id int, name varchar(255)
    ) DEFAULT CHARSET = utf8;
    
    -- test_011: succeeded
    create table if not exists t4(
        id int, name varchar(255)
    ) DEFAULT CHARSET= utf8;
    
    -- test_012: succeeded
    create table if not exists t5(
        id int, name varchar(255)
    ) DEFAULT CHARSET =utf8;
    
    -- test_013: succeeded
    create table if 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: succeeded
    create table if not exists t7(
        id int, 
        name varchar(255) CHARACTER SET utf8 COLLATE utf8mb4_general_ci
    );
    
    -- test_015: succeeded
    create table if not exists t8(
        id int, 
        name varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
    );
    
    -- 5. USING xxx (BTREE, HASH, ...)
    
    -- test_016: succeeded
    create table if not exists t9(
        id int, 
        name varchar(255),
        primary key (id)  USING BTREE
    );
    
    
    -- 6. UNLOCK TABLES and LOCK TABLES
    -- test_017: succeeded
    create table t10 (id int);
    LOCK TABLES t10 WRITE;
    alter table t10 add column class varchar(50);
    UNLOCK TABLES;
    
    
    -- 7. AUTO_INCREMENT=xxx, AUTO_INCREMENT xxx
    -- test_018: succeeded
    create table t11 (id int AUTO_INCREMENT);
    
    -- test_019: succeeded
    create table t12 (id int) AUTO_INCREMENT = 157472;
    
    -- test_020: succeeded
    create table t13 (id int AUTO_INCREMENT)
    AUTO_INCREMENT = 157472;
    
    -- 8. ROW_FORMAT=xxx (COMPACT)
    -- test_021: succeeded
    create table t14 (id int)
    ROW_FORMAT=DYNAMIC;
    
    -- test_022: succeeded
    create table t15 (id int)
    ROW_FORMAT = COMPACT;
    
    -- 9. SET @saved_cs_client = xxx
    -- test_023: succeeded
    SET @saved_cs_client = xxx;
    
    -- 10. SET character_set_client  = xxx
    -- test_024: failed
    -- succeeded
    SET character_set_client  = xxx;
    -- failed
    SET @MYSQLDUMP_TEMP_LOG_BIN = @@SESSION.SQL_LOG_BIN;
    
    -- 11. ALTER TABLE in /*!xx xx */
    -- test_025: succeeded
    create table t16 (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: succeeded
    create table t17(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: succeeded
    create table t18 (id int, gender enum('male', 'female'));
    
    -- test_028: succeeded
    create table t19 (id int, gender enum('male', 'female') NOT NULL);
    
    -- test_030: failed
    -- issue: https://github.com/matrixorigin/MO-Cloud/issues/1181
    create table t19 (id int, gender enum('male', 'female') default 'male');
    
    -- test_031: failed
    -- issue: https://github.com/matrixorigin/MO-Cloud/issues/1181
    CREATE TABLE `t20` (id int, gender enum('male', 'female') NOT NULL default 'male');
    
    
    -- 14. partition by
    -- test_032: succeeded
    CREATE TABLE t21 (
      `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: succeeded
    CREATE TABLE t22 (
      `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: succeeded
    CREATE TABLE t23 (id int, name varchar(50));
    insert into t23 values(1,'ashley'),(2,'ben'),(3,'cindy');
    select * from t23;
    CREATE VIEW v2 AS select convert(`t23`.`name` using utf8mb4) as converted_name from t23;
    SHOW CREATE VIEW v2;
    select * from v2;
    
    -- 16. Numeric
    -- test_035: succeeded
    CREATE TABLE t24 (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: succeeded
    create table if 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;
  14. lacrimosaprinz commented on Aug 19, 2023

    @lacrimosaprinz
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

attention/doc-influencekind/featurepriority/p-1source/on-demand

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions