Commit 8916aa58 authored by 智勇's avatar 智勇

兼容db name有 - 的情况

parent 1fcd398a
...@@ -68,12 +68,12 @@ function db_schema_sync() ...@@ -68,12 +68,12 @@ function db_schema_sync()
if [ "$not_delete_business_data" = "false" ];then if [ "$not_delete_business_data" = "false" ];then
# echo "DROP DATABASE ${database_name};" | mysql -h $mysql_host -P $target_db_port -uqa -pqatest # echo "DROP DATABASE ${database_name};" | mysql -h $mysql_host -P $target_db_port -uqa -pqatest
echo "mysql -h $target_db_host -P $target_db_port -uqa -pqatest -e \"DROP DATABASE ${database};\"" echo "mysql -h $target_db_host -P $target_db_port -uqa -pqatest -e \"DROP DATABASE \`${database}\`;\""
mysql -h $target_db_host -P $target_db_port -uqa -pqatest -e "DROP DATABASE ${database};" mysql -h $target_db_host -P $target_db_port -uqa -pqatest -e "DROP DATABASE ${database};"
fi fi
# echo "CREATE DATABASE IF NOT EXISTS \`${database_name}\` DEFAULT CHARSET utf8 COLLATE utf8_general_ci;" | mysql -h $mysql_host -P $target_db_port -uqa -pqatest # echo "CREATE DATABASE IF NOT EXISTS \`${database_name}\` DEFAULT CHARSET utf8 COLLATE utf8_general_ci;" | mysql -h $mysql_host -P $target_db_port -uqa -pqatest
echo "mysql -h $target_db_host -P $target_db_port -uqa -pqatest -e \"CREATE DATABASE IF NOT EXISTS ${database} DEFAULT CHARSET utf8 COLLATE utf8_general_ci;\"" echo "mysql -h $target_db_host -P $target_db_port -uqa -pqatest -e \"CREATE DATABASE IF NOT EXISTS ${database} DEFAULT CHARSET utf8 COLLATE utf8_general_ci;\""
mysql -h $target_db_host -P $target_db_port -u$target_db_user -pqatest -e "CREATE DATABASE IF NOT EXISTS ${database} DEFAULT CHARSET utf8 COLLATE utf8_general_ci;" mysql -h $target_db_host -P $target_db_port -u$target_db_user -pqatest -e "CREATE DATABASE IF NOT EXISTS \`${database}\` DEFAULT CHARSET utf8 COLLATE utf8_general_ci;"
if [ $? != 0 ];then echo "mysql -h $target_db_host -P $target_db_port -uqa -pqatest -e \"CREATE DATABASE IF NOT EXISTS ${database}\" error";exit -1; fi if [ $? != 0 ];then echo "mysql -h $target_db_host -P $target_db_port -uqa -pqatest -e \"CREATE DATABASE IF NOT EXISTS ${database}\" error";exit -1; fi
echo "mkdir $db_backup_sub_folders" echo "mkdir $db_backup_sub_folders"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment