github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/tests/integration_tests/ddl_manager/data/prepare.sql (about)

     1  drop database if exists `ddl_manager`;
     2  create database `ddl_manager`;
     3  
     4  drop database if exists `ddl_manager_test1`;
     5  create database `ddl_manager_test1`;
     6  
     7  drop database if exists `ddl_manager_test2`;
     8  create database `ddl_manager_test2`;
     9  
    10  drop database if exists `ddl_manager_test3`;
    11  create database `ddl_manager_test3`;
    12  
    13  use `ddl_manager`;
    14  
    15  create table t1 (
    16                      id INT AUTO_INCREMENT PRIMARY KEY,
    17                      val INT DEFAULT 0,
    18                      col0 INT NOT NULL
    19  );
    20  INSERT INTO t1 (val, col0) VALUES (1, 1);
    21  INSERT INTO t1 (val, col0) VALUES (2, 2);
    22  INSERT INTO t1 (val, col0) VALUES (3, 3);
    23  INSERT INTO t1 (val, col0) VALUES (4, 4);
    24  INSERT INTO t1 (val, col0) VALUES (5, 5);
    25  
    26  
    27  CREATE TABLE t2 (
    28                      id INT AUTO_INCREMENT PRIMARY KEY,
    29                      val INT DEFAULT 0,
    30                      col0 INT NOT NULL
    31  );
    32  INSERT INTO t2 (val, col0) VALUES (1, 1);
    33  INSERT INTO t2 (val, col0) VALUES (2, 2);
    34  INSERT INTO t2 (val, col0) VALUES (3, 3);
    35  INSERT INTO t2 (val, col0) VALUES (4, 4);
    36  INSERT INTO t2 (val, col0) VALUES (5, 5);
    37  
    38  drop table  t2;
    39  
    40  create table t3 (
    41                      a int, primary key (a)
    42  ) partition by hash(a) partitions 5;
    43  insert into t3 values (1),(2),(3),(4),(5),(6);
    44  insert into t3 values (7),(8),(9);
    45  alter table t3 truncate partition p3;
    46  
    47  create table t4 (a int primary key) PARTITION BY RANGE ( a ) ( PARTITION p0 VALUES LESS THAN (6),PARTITION p1 VALUES LESS THAN (11),PARTITION p2 VALUES LESS THAN (21));
    48  insert into t4 values (1),(2),(3),(4),(5),(6);
    49  insert into t4 values (7),(8),(9);
    50  insert into t4 values (11),(12),(20);
    51  alter table t4 add partition (partition p3 values less than (30), partition p4 values less than (40));
    52  
    53  CREATE TABLE t5 (
    54                      id INT AUTO_INCREMENT PRIMARY KEY,
    55                      val INT DEFAULT 0,
    56                      col0 INT NOT NULL
    57  );
    58  
    59  CREATE TABLE t6 (
    60                      id INT AUTO_INCREMENT PRIMARY KEY,
    61                      val INT DEFAULT 0,
    62                      col0 INT NOT NULL
    63  );
    64  
    65  DROP TABLE t5;
    66  
    67  drop database if exists `ddl_manager_test2`;
    68  
    69  CREATE TABLE t7 (
    70                      id INT AUTO_INCREMENT PRIMARY KEY,
    71                      val INT DEFAULT 0,
    72                      col0 INT NOT NULL
    73  );
    74  
    75  DROP TABLE t6;
    76  
    77  CREATE TABLE t8 (
    78                      id INT AUTO_INCREMENT PRIMARY KEY,
    79                      val INT DEFAULT 0,
    80                      col0 INT NOT NULL
    81  );
    82  
    83  DROP TABLE t7;
    84  
    85  CREATE TABLE t9 (
    86                      id INT AUTO_INCREMENT PRIMARY KEY,
    87                      val INT DEFAULT 0,
    88                      col0 INT NOT NULL
    89  );
    90  
    91  DROP TABLE t8;
    92  
    93  CREATE TABLE t10 (
    94                       id INT AUTO_INCREMENT PRIMARY KEY,
    95                       val INT DEFAULT 0,
    96                       col0 INT NOT NULL
    97  );
    98  
    99  DROP TABLE t9;
   100  
   101  
   102  drop database if exists `cross_db_1`;
   103  create database `cross_db_1`;
   104  
   105  drop database if exists `cross_db_2`;
   106  create database `cross_db_2`;
   107  
   108  use `cross_db_1`;
   109  
   110  CREATE TABLE t1 (
   111                      id INT AUTO_INCREMENT PRIMARY KEY,
   112                      val INT DEFAULT 0,
   113                      col0 INT NOT NULL
   114  );
   115  
   116  RENAME TABLE `cross_db_1`.`t1` TO `cross_db_2`.`t1`;
   117  
   118  CREATE TABLE `cross_db_1`.`t2` like `cross_db_2`.`t1`;
   119  
   120  
   121  CREATE TABLE ddl_manager.finish_mark (
   122                       id INT AUTO_INCREMENT PRIMARY KEY,
   123                       val INT DEFAULT 0,
   124                       col0 INT NOT NULL
   125  );
   126  
   127