github.com/pingcap/ticdc@v0.0.0-20220526033649-485a10ef2652/tests/force_replicate_table/data/test.sql (about)

     1  drop database if exists `force_replicate_table`;
     2  create database `force_replicate_table`;
     3  use `force_replicate_table`;
     4  
     5  CREATE TABLE t0 (id bigint primary key, a int);
     6  CREATE TABLE t1 (id bigint not null unique key, a int);
     7  CREATE TABLE t2 (id bigint unique key, a int);
     8  CREATE TABLE t3 (id bigint, a int);
     9  CREATE TABLE t4 (id varchar(20) unique key, a int);
    10  CREATE TABLE t5 (id varchar(20), a int);
    11  
    12  insert into t0 (id) values (1),(2),(3),(4),(5);
    13  insert into t1 (id) values (1),(2),(3),(4),(5);
    14  insert into t2 (id) values (null),(null),(1),(2),(3),(4),(5);
    15  insert into t3 (id) values (null),(null),(1),(1),(2),(3),(4);
    16  insert into t4 (id) values (null),(null),('1'),('2'),('3'),('4');
    17  insert into t5 (id) values (null),(null),('1'),('1'),('2'),('3'),('4');
    18  
    19  update t0 set a = 1;
    20  update t1 set a = 1;
    21  update t2 set a = 1;
    22  update t3 set a = 1;
    23  update t4 set a = 1;
    24  update t5 set a = 1;
    25  
    26  alter table t0 drop primary key;
    27  alter table t1 drop key id;
    28  
    29  update t0 set a = 2 where id > 3;
    30  update t1 set a = 2 where id > 2;
    31  
    32  delete from t0 where id < 3;
    33  delete from t1 where id < 3;
    34  delete from t2 where id < 3;
    35  delete from t3 where id < 3;
    36  delete from t4 where id < '3';
    37  delete from t5 where id < '3';
    38  
    39  create table t6 (id int primary key, a int) PARTITION BY RANGE ( id ) ( PARTITION p0 VALUES LESS THAN (6),PARTITION p1 VALUES LESS THAN (11),PARTITION p2 VALUES LESS THAN (21));
    40  insert into t6 (id) values (1),(2),(3),(4),(5),(6);
    41  insert into t6 (id) values (7),(8),(9);
    42  insert into t6 (id) values (11),(12),(20);
    43  alter table t6 add partition (partition p3 values less than (30), partition p4 values less than (40));
    44  insert into t6 (id) values (25),(29),(35);
    45  alter table t6 truncate partition p0;
    46  alter table t6 drop partition p1;
    47  insert into t6 (id) values (7),(8),(9);
    48  update t6 set id=id+10 where id=9;