From edad4c2975fab88b93b49b1f0165a4ae0cb2a960 Mon Sep 17 00:00:00 2001 From: pingcap-github-bot Date: Mon, 2 Dec 2019 14:48:33 +0800 Subject: [PATCH] pkg: support to sync alter database DDL (#389) --- pkg/utils/util.go | 3 --- syncer/filter_test.go | 4 ---- tests/all_mode/data/db1.increment.sql | 3 +++ 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/pkg/utils/util.go b/pkg/utils/util.go index 08ed222824..408d93227c 100644 --- a/pkg/utils/util.go +++ b/pkg/utils/util.go @@ -85,9 +85,6 @@ var ( "^RENAME\\s+USER", "^DROP\\s+USER", "^SET\\s+PASSWORD", - - // alter database - "^ALTER DATABASE", } builtInSkipDDLPatterns *regexp.Regexp ) diff --git a/syncer/filter_test.go b/syncer/filter_test.go index 01894ebde1..1a6bc3b1b7 100644 --- a/syncer/filter_test.go +++ b/syncer/filter_test.go @@ -102,10 +102,6 @@ END`, true}, {"drop user t1", true}, {"GRANT ALL PRIVILEGES ON *.* TO 't2'@'%' IDENTIFIED WITH 'mysql_native_password' AS '*12033B78389744F3F39AC4CE4CCFCAD6960D8EA0'", true}, {"revoke reload on *.* from 't2'@'%'", true}, - - // alter database - {"alter database foo character set = utf8", true}, - {"alter database foo collate=utf8_bin", true}, } //filter, err := bf.NewBinlogEvent(nil) diff --git a/tests/all_mode/data/db1.increment.sql b/tests/all_mode/data/db1.increment.sql index 1495d6da5c..af79466640 100644 --- a/tests/all_mode/data/db1.increment.sql +++ b/tests/all_mode/data/db1.increment.sql @@ -24,6 +24,9 @@ update t1 set name = 'gentestxxxxxx' where gen_id = 124; -- delete with unique key delete from t1 where gen_id > 124; +-- test alter database +alter database all_mode CHARACTER SET = utf8mb4; + -- test decimal type alter table t1 add column lat decimal(9,6) default '0.000000'; insert into t1 (id, name, info, lat) values (8, 'gentest', '{"id":127}', '123.123')