1
# mysql_migrate.databases
2
# test of migration of multiple databases
3
# as used by the --databases DB1 [DB2...] format of calling
6
# We expect to not have drizzledump_migrate_test3 in our
7
# mysql-populated Drizzle system even though it exists
8
# on the MySQL server in this test
10
let $datafile = $DRIZZLETEST_VARDIR/std_data_ln/mysqlmigrate_databases.dat;
11
let $database1 = drizzledump_migrate_test1;
12
let $database2 = drizzledump_migrate_test2;
13
let $database3 = drizzledump_migrate_test3;
15
# test if we should run this test, will skip if we don't have
16
# the environment variable set
18
--require r/true.require
19
SELECT VARIABLE_VALUE AS `TRUE` FROM DATA_DICTIONARY.ENVIRONMENTAL WHERE VARIABLE_NAME="DRIZZLE_MYSQL_MIGRATE_TEST";
23
eval DROP SCHEMA IF EXISTS $database1;
24
eval DROP SCHEMA IF EXISTS $database2;
25
eval DROP SCHEMA IF EXISTS $database3;
28
# clean up our MySQL server
29
--echo Dropping test database on MySQL...
30
exec $DRIZZLE_CLIENT -uroot --port=$DRIZZLE_MYSQL_MIGRATE_PORT test -e "DROP SCHEMA IF EXISTS $database1";
31
exec $DRIZZLE_CLIENT -uroot --port=$DRIZZLE_MYSQL_MIGRATE_PORT test -e "DROP SCHEMA IF EXISTS $database2";
32
exec $DRIZZLE_CLIENT -uroot --port=$DRIZZLE_MYSQL_MIGRATE_PORT test -e "DROP SCHEMA IF EXISTS $database3";
36
--echo Create test database on MySQL...
37
exec $DRIZZLE_CLIENT -uroot --port=$DRIZZLE_MYSQL_MIGRATE_PORT test -e "CREATE SCHEMA $database1";
38
exec $DRIZZLE_CLIENT -uroot --port=$DRIZZLE_MYSQL_MIGRATE_PORT test -e "CREATE SCHEMA $database2";
39
exec $DRIZZLE_CLIENT -uroot --port=$DRIZZLE_MYSQL_MIGRATE_PORT test -e "CREATE SCHEMA $database3";
42
--echo populating MySQL with test data...
43
exec $DRIZZLE_CLIENT -uroot --port=$DRIZZLE_MYSQL_MIGRATE_PORT $database1 < $datafile;
45
--echo calling drizzledump to populate Drizzle...
46
# next line just debugging aid
47
--echo $DRIZZLE_DUMP_CLIENT --compact --host=127.0.0.1 --port=$DRIZZLE_MYSQL_MIGRATE_PORT --destination-type=database --destination-host=localhost --destination-port=$MASTER_MYPORT --destination-user=root --user=root --databases $database1 $database2
49
exec $DRIZZLE_DUMP_CLIENT --compact --host=127.0.0.1 --port=$DRIZZLE_MYSQL_MIGRATE_PORT --destination-type=database --destination-host=localhost --destination-port=$MASTER_MYPORT --destination-user=root --user=root --databases $database1 $database2 ;
51
--echo see our schemas
54
--echo test our table:
55
eval SHOW CREATE TABLE $database1.t1;
56
eval SHOW CREATE TABLE $database1.t2;
57
eval SHOW CREATE TABLE $database2.t1;
58
eval SHOW CREATE TABLE $database2.t2;
59
--echo this doesn't fail, just doesn't show anything...
60
eval SHOW CREATE TABLE $database3.t1;
62
eval SELECT * FROM $database1.t1;
63
eval SELECT * FROM $database1.t2;
64
eval SELECT * FROM $database2.t1;
65
eval SELECT * FROM $database2.t2;
66
# we expect this to fail
68
eval SELECT * FROM $database3.t1;
70
# clean up our MySQL server
71
--echo Dropping test database on MySQL...
72
exec $DRIZZLE_CLIENT -uroot --port=$DRIZZLE_MYSQL_MIGRATE_PORT test -e "DROP SCHEMA IF EXISTS $database1";
73
exec $DRIZZLE_CLIENT -uroot --port=$DRIZZLE_MYSQL_MIGRATE_PORT test -e "DROP SCHEMA IF EXISTS $database2";
74
exec $DRIZZLE_CLIENT -uroot --port=$DRIZZLE_MYSQL_MIGRATE_PORT test -e "DROP SCHEMA IF EXISTS $database3";
76
eval DROP SCHEMA $database1;
77
eval DROP SCHEMA $database2;