Skip to content

Commit

Permalink
Run migrations on update
Browse files Browse the repository at this point in the history
  • Loading branch information
dhh committed Jun 14, 2024
1 parent 571271c commit fddd007
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions bin/omakub-update
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
#!/usr/bin/bash

cd $OMAKUB_PATH
last_updated=$(git log -1 --format=%cd --date=unix)
git pull
currently_updated=$(git log -1 --format=%cd --date=unix)

if [ $last_updated -lt $currently_updated ]; then
for file in $OMAKUB_PATH/migrations/*.sh; do
# Extract the timestamp from the file name
filename=$(basename "$file")
timestamp="${filename%.sh}"

# Run the migration script if the timestamp is before the current Git revision
if [ $timestamp -lt $currently_updated ]; then
source $file
fi
done
fi

cd -
gum spin --spinner globe --title "Update has completed!" -- sleep 3
clear
Expand Down
File renamed without changes.

0 comments on commit fddd007

Please sign in to comment.