diff --git a/db/changes/10001/00-ACL.sql b/db/changes/10001-fallas/00-ACL.sql similarity index 100% rename from db/changes/10001/00-ACL.sql rename to db/changes/10001-fallas/00-ACL.sql diff --git a/db/changes/10001/00-absenceType.sql b/db/changes/10001-fallas/00-absenceType.sql similarity index 100% rename from db/changes/10001/00-absenceType.sql rename to db/changes/10001-fallas/00-absenceType.sql diff --git a/db/changes/10001/00-department.sql b/db/changes/10001-fallas/00-department.sql similarity index 100% rename from db/changes/10001/00-department.sql rename to db/changes/10001-fallas/00-department.sql diff --git a/db/changes/10001/00-holiday.sql b/db/changes/10001-fallas/00-holiday.sql similarity index 100% rename from db/changes/10001/00-holiday.sql rename to db/changes/10001-fallas/00-holiday.sql diff --git a/db/changes/10001/00-holidayDetail.sql b/db/changes/10001-fallas/00-holidayDetail.sql similarity index 100% rename from db/changes/10001/00-holidayDetail.sql rename to db/changes/10001-fallas/00-holidayDetail.sql diff --git a/db/changes/10001/00-holidayType.sql b/db/changes/10001-fallas/00-holidayType.sql similarity index 100% rename from db/changes/10001/00-holidayType.sql rename to db/changes/10001-fallas/00-holidayType.sql diff --git a/db/changes/10001/00-mailUser.sql b/db/changes/10001-fallas/00-mailUser.sql similarity index 100% rename from db/changes/10001/00-mailUser.sql rename to db/changes/10001-fallas/00-mailUser.sql diff --git a/db/changes/10001/00-nodeAdd.sql b/db/changes/10001-fallas/00-nodeAdd.sql similarity index 100% rename from db/changes/10001/00-nodeAdd.sql rename to db/changes/10001-fallas/00-nodeAdd.sql diff --git a/db/changes/10001/00-nodeRecalc.sql b/db/changes/10001-fallas/00-nodeRecalc.sql similarity index 100% rename from db/changes/10001/00-nodeRecalc.sql rename to db/changes/10001-fallas/00-nodeRecalc.sql diff --git a/db/changes/10001/00-routeGuessPriority.sql b/db/changes/10001-fallas/00-routeGuessPriority.sql similarity index 100% rename from db/changes/10001/00-routeGuessPriority.sql rename to db/changes/10001-fallas/00-routeGuessPriority.sql diff --git a/db/changes/10001/00-ticketCalculateSale.sql b/db/changes/10001-fallas/00-ticketCalculateSale.sql similarity index 100% rename from db/changes/10001/00-ticketCalculateSale.sql rename to db/changes/10001-fallas/00-ticketCalculateSale.sql diff --git a/db/changes/10001/00-ticketComponentMakeUpdate.sql b/db/changes/10001-fallas/00-ticketComponentMakeUpdate.sql similarity index 100% rename from db/changes/10001/00-ticketComponentMakeUpdate.sql rename to db/changes/10001-fallas/00-ticketComponentMakeUpdate.sql diff --git a/db/changes/10001/00-ticketComponentPreview.sql b/db/changes/10001-fallas/00-ticketComponentPreview.sql similarity index 100% rename from db/changes/10001/00-ticketComponentPreview.sql rename to db/changes/10001-fallas/00-ticketComponentPreview.sql diff --git a/db/changes/10001/00-ticketComponentUpdate.sql b/db/changes/10001-fallas/00-ticketComponentUpdate.sql similarity index 100% rename from db/changes/10001/00-ticketComponentUpdate.sql rename to db/changes/10001-fallas/00-ticketComponentUpdate.sql diff --git a/db/changes/10001/00-ticketGetProblems.sql b/db/changes/10001-fallas/00-ticketGetProblems.sql similarity index 100% rename from db/changes/10001/00-ticketGetProblems.sql rename to db/changes/10001-fallas/00-ticketGetProblems.sql diff --git a/db/changes/10001/00-ticketGetVisibleAvailable.sql b/db/changes/10001-fallas/00-ticketGetVisibleAvailable.sql similarity index 100% rename from db/changes/10001/00-ticketGetVisibleAvailable.sql rename to db/changes/10001-fallas/00-ticketGetVisibleAvailable.sql diff --git a/db/changes/10001/00-ticketLog.sql b/db/changes/10001-fallas/00-ticketLog.sql similarity index 100% rename from db/changes/10001/00-ticketLog.sql rename to db/changes/10001-fallas/00-ticketLog.sql diff --git a/db/changes/10001/00-workCenterHoliday.sql b/db/changes/10001-fallas/00-workCenterHoliday.sql similarity index 100% rename from db/changes/10001/00-workCenterHoliday.sql rename to db/changes/10001-fallas/00-workCenterHoliday.sql diff --git a/db/changes/10001/00-workerCalendar.sql b/db/changes/10001-fallas/00-workerCalendar.sql similarity index 100% rename from db/changes/10001/00-workerCalendar.sql rename to db/changes/10001-fallas/00-workerCalendar.sql diff --git a/db/changes/10001/00-workerLabour.sql b/db/changes/10001-fallas/00-workerLabour.sql similarity index 100% rename from db/changes/10001/00-workerLabour.sql rename to db/changes/10001-fallas/00-workerLabour.sql diff --git a/db/changes/10002/00-routeLog.sql b/db/changes/10002-lent/00-routeLog.sql similarity index 100% rename from db/changes/10002/00-routeLog.sql rename to db/changes/10002-lent/00-routeLog.sql diff --git a/db/changes/10002/00-workerGetHierarch.sql b/db/changes/10002-lent/00-workerGetHierarch.sql similarity index 100% rename from db/changes/10002/00-workerGetHierarch.sql rename to db/changes/10002-lent/00-workerGetHierarch.sql diff --git a/db/import-changes.sh b/db/import-changes.sh index aecb2014e..0c986afe8 100755 --- a/db/import-changes.sh +++ b/db/import-changes.sh @@ -80,21 +80,22 @@ fi N_CHANGES=0 echo "[INFO] Applying changes." -for VERSION_DIR in "$DIR/changes/"*; do - DIR_VERSION=$(basename $VERSION_DIR) +for DIR_PATH in "$DIR/changes/"*; do + DIR_NAME=$(basename $DIR_PATH) + DIR_VERSION=${DIR_NAME:0:5} - if [[ ! "$DIR_VERSION" =~ ^[0-9]{5}$ ]]; then - echo "[INFO] Ignoring wrong version number: $DIR_VERSION" + if [[ ! "$DIR_NAME" =~ ^[0-9]{5}(-[a-zA-Z0-9]+)?$ ]]; then + echo "[WARN] Ignoring wrong directory name: $DIR_NAME" continue fi if [ "$DB_VERSION" -ge "$DIR_VERSION" ]; then - echo "[INFO] Ignoring already applied version: $DIR_VERSION" + echo "[INFO] Ignoring already applied version: $DIR_NAME" continue fi - echo "[INFO] Applying version: $DIR_VERSION" + echo "[INFO] Applying version: $DIR_NAME" - for FILE in "$VERSION_DIR/"*; do + for FILE in "$DIR_PATH/"*; do echo "[INFO] -> $(basename "$FILE")" mysql --defaults-file="$INI_FILE" --comments < $FILE N_CHANGES=$((N_CHANGES + 1)) @@ -106,5 +107,7 @@ done if [ "$N_CHANGES" -eq "0" ]; then echo "[INFO] No changes to apply." +else + echo "[INFO] Changes applied succesfully." fi