summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorYehonal <yehonal.azeroth@gmail.com>2016-08-30 15:41:59 +0200
committerYehonal <yehonal.azeroth@gmail.com>2016-08-30 15:41:59 +0200
commit88b1881d22156457c28f83433d51b0cf60e4e615 (patch)
treef9cf0d17ceeda618f561139bf151cf90ea469f98 /bin
parent925defe406520f61fc4753c072560f1f17032431 (diff)
[BASH/DB] Fixed importing script with revisioned sql
Diffstat (limited to 'bin')
-rwxr-xr-xbin/db_pendings/import.sh11
1 files changed, 7 insertions, 4 deletions
diff --git a/bin/db_pendings/import.sh b/bin/db_pendings/import.sh
index cf85cd349e..5ee63a0f65 100755
--- a/bin/db_pendings/import.sh
+++ b/bin/db_pendings/import.sh
@@ -51,11 +51,14 @@ function import() {
suffix=${oldFile#rev_}
rev=${suffix%.sql}
- [[ $prefix = "rev" && $suffix =~ ^-?[0-9]+$ ]] && isRev=1 || isRev=0
+ isRev=0
+ if [[ $prefix = "rev" && $rev =~ ^-?[0-9]+$ ]]; then
+ isRev=1
+ fi
echo "-- DB update $oldVer -> $newVer" > "$newFile";
- if [[ $isRev ]]; then
+ if [[ $isRev -eq 1 ]]; then
echo "DROP PROCEDURE IF EXISTS \`updateDb\`;" >> "$newFile";
echo "DELIMITER //" >> "$newFile";
echo "CREATE PROCEDURE updateDb ()" >> "$newFile";
@@ -65,7 +68,7 @@ function import() {
echo "$startTransaction" >> "$newFile";
echo "$updHeader" >> "$newFile";
- if [[ $isRev ]]; then
+ if [[ $isRev -eq 1 ]]; then
echo "SELECT sql_rev INTO OK FROM version_db_"$db" WHERE sql_rev = '$rev'; IF OK <> 'FALSE' THEN LEAVE proc; END IF;" >> "$newFile";
fi;
@@ -81,7 +84,7 @@ function import() {
echo "$endTransaction" >> "$newFile";
- if [[ $isRev ]]; then
+ if [[ $isRev -eq 1 ]]; then
echo "END;" >> "$newFile";
echo "//" >> "$newFile";
echo "DELIMITER ;" >> "$newFile";