github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/engine/test/integration_tests/dm_lightning_checkpoint/data/db1.prepare.sql (about)

     1  drop user if exists 'dm_full';
     2  flush privileges;
     3  create user 'dm_full'@'%' identified by '123456';
     4  grant all privileges on *.* to 'dm_full'@'%';
     5  
     6  drop database if exists `dm_full`;
     7  create database `dm_full` CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin;
     8  use `dm_full`;
     9  create table t1 (
    10      id int,
    11      name varchar(20),
    12      ts timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    13      primary key(`id`));
    14  insert into t1 (id, name, ts) values (1, 'arya', now()), (2, 'catelyn', '2021-05-11 10:01:03');
    15  insert into t1 (id, name) values (3, 'Eddard
    16  Stark');
    17  update t1 set name = 'Arya S\\\\tark' where id = 1;
    18  update t1 set name = 'Catelyn S\"\n\ttark' where name = 'catelyn';
    19  
    20  -- test multi column index with generated column
    21  alter table t1 add column info json;
    22  alter table t1 add column gen_id int as (info->"$.id");
    23  alter table t1 add index multi_col(`id`, `gen_id`);
    24  insert into t1 (id, name, info) values (4, 'gentest', '{"id": 123}');
    25  insert into t1 (id, name, info) values (5, 'gentest', '{"id": 124}');
    26  update t1 set info = '{"id": 120}' where id = 1;
    27  update t1 set info = '{"id": 121}' where id = 2;
    28  update t1 set info = '{"id": 122}' where id = 3;
    29  
    30  -- test genColumnCache is reset after ddl
    31  alter table t1 add column info2 varchar(40);
    32  insert into t1 (id, name, info) values (6, 'gentest', '{"id": 125, "test cache": false}');
    33  alter table t1 add unique key gen_idx(`gen_id`);
    34  update t1 set name = 'gentestxx' where gen_id = 123;
    35  
    36  insert into t1 (id, name, info) values (7, 'gentest', '{"id": 126}');
    37  update t1 set name = 'gentestxxxxxx' where gen_id = 124;
    38  -- delete with unique key
    39  delete from t1 where gen_id > 124;