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;
29
# we migrate the test db back from MySQL so we drop the drizzle one
30
CREATE SCHEMA tmp_test;
34
# clean up our MySQL server
35
--echo Dropping test database on MySQL...
36
exec $DRIZZLE_CLIENT -uroot --port=$DRIZZLE_MYSQL_MIGRATE_PORT test -e "DROP SCHEMA IF EXISTS $database1";
37
exec $DRIZZLE_CLIENT -uroot --port=$DRIZZLE_MYSQL_MIGRATE_PORT test -e "DROP SCHEMA IF EXISTS $database2";
38
exec $DRIZZLE_CLIENT -uroot --port=$DRIZZLE_MYSQL_MIGRATE_PORT test -e "DROP SCHEMA IF EXISTS $database3";
42
--echo Create test database on MySQL...
43
exec $DRIZZLE_CLIENT -uroot --port=$DRIZZLE_MYSQL_MIGRATE_PORT test -e "CREATE SCHEMA $database1";
44
exec $DRIZZLE_CLIENT -uroot --port=$DRIZZLE_MYSQL_MIGRATE_PORT test -e "CREATE SCHEMA $database2";
45
exec $DRIZZLE_CLIENT -uroot --port=$DRIZZLE_MYSQL_MIGRATE_PORT test -e "CREATE SCHEMA $database3";
48
--echo populating MySQL with test data...
49
exec $DRIZZLE_CLIENT -uroot --port=$DRIZZLE_MYSQL_MIGRATE_PORT $database1 < $datafile;
51
--echo calling drizzledump to populate Drizzle...
52
# next line just debugging aid
53
--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 --all-databases;
55
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 --all-databases ;
57
--echo see our schemas
60
--echo test our table:
61
eval SHOW CREATE TABLE $database1.t1;
62
eval SHOW CREATE TABLE $database1.t2;
63
eval SHOW CREATE TABLE $database2.t1;
64
eval SHOW CREATE TABLE $database2.t2;
65
--echo The table_name is a lie!
66
# we reuse the test bed from another test
67
eval SHOW CREATE TABLE $database3.not_on_drizzle;
69
eval SELECT * FROM $database1.t1;
70
eval SELECT * FROM $database1.t2;
71
eval SELECT * FROM $database2.t1;
72
eval SELECT * FROM $database2.t2;
73
--echo The table_name is a lie!
74
# we reuse the test bed from another test
75
eval SELECT * FROM $database3.not_on_drizzle;
77
# clean up our MySQL server
78
--echo Dropping test database on MySQL...
79
exec $DRIZZLE_CLIENT -uroot --port=$DRIZZLE_MYSQL_MIGRATE_PORT test -e "DROP SCHEMA IF EXISTS $database1";
80
exec $DRIZZLE_CLIENT -uroot --port=$DRIZZLE_MYSQL_MIGRATE_PORT test -e "DROP SCHEMA IF EXISTS $database2";
81
exec $DRIZZLE_CLIENT -uroot --port=$DRIZZLE_MYSQL_MIGRATE_PORT test -e "DROP SCHEMA IF EXISTS $database3";
83
eval DROP SCHEMA $database1;
84
eval DROP SCHEMA $database2;
85
eval DROP SCHEMA $database3;