Commit 8b2c4696 authored by 智勇's avatar 智勇

增加外键兼容

parent 9c9e1edc
......@@ -30,6 +30,8 @@ fi
dropSQL=`curl -s -m 5 http://qaapi.liangkebang.com/dbsync/getDropSQL?dbName=${db_name}`
echo "dropSQL: ${dropSQL}"
echo "mysql -h $mysql_host -P $target_db_port -uqa -pqatest $db_name -e ${dropSQL}"
mysql -h $mysql_host -P $target_db_port -uqa -pqatest $db_name -e "${dropSQL}"
if [ -n "$dropSQL" ];then
echo "mysql -h $mysql_host -P $target_db_port -uqa -pqatest $db_name -e ${dropSQL}"
mysql -h $mysql_host -P $target_db_port -uqa -pqatest $db_name -e "${dropSQL}"
fi
mysql_host=$1
db_name=$2
target_db_port=$3
sql_file_folder=/home/qa-deploy-utils/db-utils/foreign_key
echo "cd $sql_file_folder"
cd $sql_file_folder
if [ -n "$db_name" ];then
if [ -f $db_name.sql ];then
echo "exec foreign base sql"
echo "mysql -h $mysql_host -P $target_db_port -uqa -pqatest < $db_name.sql"
mysql -h $mysql_host -P $target_db_port -uqa -pqatest < $db_name.sql
else
echo "have no $db_name foreign base sql"
fi
fi
\ No newline at end of file
......@@ -7,8 +7,7 @@
# Description: 实现数据库表结构同步
# -------------------------------------------------------------------------------
source ~/.bash_profile
source ~/.profile
# source ~/.bash_profile
pwd_path="/home/qa-deploy-utils"
# if [ $# -ne 11 ]; then
......@@ -102,7 +101,7 @@ function db_schema_sync()
fi
echo "--- Step 3: sync schema: $database $target_db_host ---"
#sync_cmd="mss -conf ${config_file_name} -sync"
sh $work_dir/db_foreign_base.sh $target_db_host $sync_db_name $target_db_port
echo "mss -conf ${config_file_name} -sync > /dev/null"
mss -conf ${config_file_name} -sync > /dev/null
echo "mysql-schema-sync result:$?"
......
This diff is collapsed.
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