Convert MyISAM database tables to InnoDB

Finds and converts any database tables using MyISAM storage engine to InnoDB.

output=$( wp db query "SELECT COUNT(*) FROM information_schema.TABLES WHERE ENGINE = 'MyISAM'" --skip-column-names )
if [[ "$output" -gt "0" ]]; then
	echo "Found $output MyISAM tables"
	wp db query "SELECT CONCAT('ALTER TABLE ', TABLE_SCHEMA,'.', TABLE_NAME, ' ENGINE=InnoDB;') FROM information_schema.TABLES WHERE ENGINE = 'MyISAM'" --skip-column-names > db_optimize.sql
	wp db query < db_optimize.sql
	rm db_optimize.sql
fi