DB versioning fixes
This commit is contained in:
parent
479b4c68c8
commit
a12ef2c290
|
@ -43,7 +43,7 @@ if [ "$ENV" == "production" ]; then
|
||||||
|
|
||||||
if [ "$ANSWER" != "yes" ]; then
|
if [ "$ANSWER" != "yes" ]; then
|
||||||
echo "[INFO] Aborting changes."
|
echo "[INFO] Aborting changes."
|
||||||
exit;
|
exit
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -83,7 +83,15 @@ echo "[INFO] Applying changes."
|
||||||
for VERSION_DIR in "$DIR/changes/"*; do
|
for VERSION_DIR in "$DIR/changes/"*; do
|
||||||
DIR_VERSION=$(basename $VERSION_DIR)
|
DIR_VERSION=$(basename $VERSION_DIR)
|
||||||
|
|
||||||
if [ "$DB_VERSION" -lt "$DIR_VERSION" ]; then
|
if [[ ! "$DIR_VERSION" =~ ^[0-9]{5}$ ]]; then
|
||||||
|
echo "[INFO] Ignoring wrong version number: $DIR_VERSION"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if [ "$DB_VERSION" -ge "$DIR_VERSION" ]; then
|
||||||
|
echo "[INFO] Ignoring already applied version: $DIR_VERSION"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
echo "[INFO] Applying version: $DIR_VERSION"
|
echo "[INFO] Applying version: $DIR_VERSION"
|
||||||
|
|
||||||
for FILE in "$VERSION_DIR/"*; do
|
for FILE in "$VERSION_DIR/"*; do
|
||||||
|
@ -94,7 +102,6 @@ for VERSION_DIR in "$DIR/changes/"*; do
|
||||||
|
|
||||||
UPDATE_VERSION="UPDATE util.config SET dbVersion='$DIR_VERSION'"
|
UPDATE_VERSION="UPDATE util.config SET dbVersion='$DIR_VERSION'"
|
||||||
echo "$UPDATE_VERSION" | mysql --defaults-file="$INI_FILE"
|
echo "$UPDATE_VERSION" | mysql --defaults-file="$INI_FILE"
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$N_CHANGES" -eq "0" ]; then
|
if [ "$N_CHANGES" -eq "0" ]; then
|
||||||
|
|
Loading…
Reference in New Issue