diff options
author | Mike Delago <32778141+michaeldelago@users.noreply.github.com> | 2024-10-15 15:06:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-15 15:06:43 -0400 |
commit | f1b629035f5eabb2423f822158446e402eda2a1a (patch) | |
tree | eba5f7651d5858d76ecc46d85756c7bab1e8c955 /apps/ci | |
parent | 998d548a3ea01d70ae1518a87e9de9e176f8bb5b (diff) |
fix(CI/Import SQL): reference previous pending update in header (#20219)
Diffstat (limited to 'apps/ci')
-rw-r--r-- | apps/ci/ci-pending-sql.sh | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/apps/ci/ci-pending-sql.sh b/apps/ci/ci-pending-sql.sh index e22b742b07..ef2d323273 100644 --- a/apps/ci/ci-pending-sql.sh +++ b/apps/ci/ci-pending-sql.sh @@ -35,13 +35,15 @@ function import() { PENDING_PATH="$AC_PATH_ROOT/data/sql/updates/pending_db_$1" UPDATES_DIR="$UPDATES_PATH/db_$1" - # Get latest SQL file applied to this database + # Get the most recent SQL file applied to this database. Used for the header comment LATEST_UPDATE="$(find "$UPDATES_DIR" -iname "*.sql" | sort -h | tail -n 1)" + # Get latest SQL file applied to this database, today. This could be empty. + LATEST_UPDATE_TODAY="$(find "$UPDATES_DIR" -iname "$TODAY*.sql" | sort -h | tail -n 1)" for entry in "$PENDING_PATH"/*.sql do if [[ -f "$entry" ]]; then - INDEX="$(get_next_index "$LATEST_UPDATE")" + INDEX="$(get_next_index "$LATEST_UPDATE_TODAY")" OUTPUT_FILE="${UPDATES_DIR}/${TODAY}_${INDEX}.sql" # ensure a note is added as a header comment @@ -51,6 +53,7 @@ function import() { # remove the unneeded file rm -f "$entry" # set the newest file to the file we just moved + LATEST_UPDATE_TODAY="$OUTPUT_FILE" LATEST_UPDATE="$OUTPUT_FILE" fi done |