GIF89a;
Direktori : /usr/share/mysql-test/t/ |
Current File : //usr/share/mysql-test/t/wl6219-upgrade.test |
# # WL#6219: Deprecate and remove YEAR(2) type # --source include/mysql_upgrade_preparation.inc --source include/have_innodb.inc let $MYSQLD_DATADIR= `select @@datadir`; --echo # --echo # Test with a saved MyISAM table from 4.1 --echo # --copy_file std_data/wl6219_41.frm $MYSQLD_DATADIR/test/t1.frm --chmod 0777 $MYSQLD_DATADIR/test/t1.frm --copy_file std_data/wl6219_41.MYD $MYSQLD_DATADIR/test/t1.MYD --chmod 0777 $MYSQLD_DATADIR/test/t1.MYD --copy_file std_data/wl6219_41.MYI $MYSQLD_DATADIR/test/t1.MYI --chmod 0777 $MYSQLD_DATADIR/test/t1.MYI --echo # Everything _looks_ fine SHOW CREATE TABLE t1; --echo # Run CHECK TABLE, it should indicate table need a REPAIR TABLE CHECK TABLE t1 FOR UPGRADE; --echo # Run REPAIR TABLE to alter the table and repair the YEAR(2) fields REPAIR TABLE t1; --echo # Now check it's back to normal SHOW CREATE TABLE t1; SELECT * FROM t1; DROP TABLE t1; --echo # ALTER TABLE ... FORCE should convert YEAR(2) to YEAR(4) --copy_file std_data/wl6219_41.frm $MYSQLD_DATADIR/test/t1.frm --chmod 0777 $MYSQLD_DATADIR/test/t1.frm --copy_file std_data/wl6219_41.MYD $MYSQLD_DATADIR/test/t1.MYD --chmod 0777 $MYSQLD_DATADIR/test/t1.MYD --copy_file std_data/wl6219_41.MYI $MYSQLD_DATADIR/test/t1.MYI --chmod 0777 $MYSQLD_DATADIR/test/t1.MYI ALTER TABLE t1 FORCE; SHOW CREATE TABLE t1; DROP TABLE t1; --echo # --echo # Test with a saved MyISAM table from 5.5 --echo # --copy_file std_data/wl6219_55.frm $MYSQLD_DATADIR/test/t1.frm --chmod 0777 $MYSQLD_DATADIR/test/t1.frm --copy_file std_data/wl6219_55.MYD $MYSQLD_DATADIR/test/t1.MYD --chmod 0777 $MYSQLD_DATADIR/test/t1.MYD --copy_file std_data/wl6219_55.MYI $MYSQLD_DATADIR/test/t1.MYI --chmod 0777 $MYSQLD_DATADIR/test/t1.MYI --echo # Everything _looks_ fine SHOW CREATE TABLE t1; --echo # Run CHECK TABLE, it should indicate table need a REPAIR TABLE CHECK TABLE t1 FOR UPGRADE; --echo # Run REPAIR TABLE to alter the table and repair the YEAR(2) fields REPAIR TABLE t1; --echo # Now check it's back to normal SHOW CREATE TABLE t1; SELECT * FROM t1; DROP TABLE t1; --echo # ALTER TABLE ... FORCE should convert YEAR(2) to YEAR(4) --copy_file std_data/wl6219_55.frm $MYSQLD_DATADIR/test/t1.frm --chmod 0777 $MYSQLD_DATADIR/test/t1.frm --copy_file std_data/wl6219_55.MYD $MYSQLD_DATADIR/test/t1.MYD --chmod 0777 $MYSQLD_DATADIR/test/t1.MYD --copy_file std_data/wl6219_55.MYI $MYSQLD_DATADIR/test/t1.MYI --chmod 0777 $MYSQLD_DATADIR/test/t1.MYI ALTER TABLE t1 FORCE; SHOW CREATE TABLE t1; DROP TABLE t1; --echo # --echo # Test with InnoDB table (with fake .frm file) --echo # --copy_file std_data/wl6219_55.frm $MYSQLD_DATADIR/test/t1.frm --chmod 0777 $MYSQLD_DATADIR/test/t1.frm --copy_file std_data/wl6219_55.MYD $MYSQLD_DATADIR/test/t1.MYD --chmod 0777 $MYSQLD_DATADIR/test/t1.MYD --copy_file std_data/wl6219_55.MYI $MYSQLD_DATADIR/test/t1.MYI --chmod 0777 $MYSQLD_DATADIR/test/t1.MYI --echo # Create InnoDB table with YEAR(4) columns ALTER TABLE t1 ENGINE=InnoDB; SHOW CREATE TABLE t1; FLUSH TABLE t1; --echo # Replace YEAR(4) column metadata with YEAR(2) metadata --remove_file $MYSQLD_DATADIR/test/t1.frm --copy_file std_data/wl6219_55_innodb.frm $MYSQLD_DATADIR/test/t1.frm --chmod 0777 $MYSQLD_DATADIR/test/t1.frm SHOW CREATE TABLE t1; --echo # Run CHECK TABLE, it should indicate table need a REPAIR TABLE CHECK TABLE t1 FOR UPGRADE; --echo # Run ALTER TABLE ... FORCE to alter the table and repair the YEAR(2) fields ALTER TABLE t1 FORCE; SHOW CREATE TABLE t1; DROP TABLE t1; --echo # --echo # Test mysql_upgrade tool --echo # --copy_file std_data/wl6219_55.frm $MYSQLD_DATADIR/test/t1.frm --chmod 0777 $MYSQLD_DATADIR/test/t1.frm --copy_file std_data/wl6219_55.MYD $MYSQLD_DATADIR/test/t1.MYD --chmod 0777 $MYSQLD_DATADIR/test/t1.MYD --copy_file std_data/wl6219_55.MYI $MYSQLD_DATADIR/test/t1.MYI --chmod 0777 $MYSQLD_DATADIR/test/t1.MYI --exec $MYSQL_UPGRADE --skip-verbose --force 2>&1 --remove_file $MYSQLD_DATADIR/mysql_upgrade_info SHOW CREATE TABLE t1; DROP TABLE t1; --echo #