Simplify migrations script

This commit is contained in:
David Heinemeier Hansson
2025-08-03 14:07:39 +02:00
parent cb08f4ccd2
commit 83e5faf224

View File

@ -8,19 +8,13 @@ STATE_DIR="$HOME/.local/state/omarchy/migrations"
mkdir -p "$STATE_DIR"
# Run any pending migrations
cd ~/.local/share/omarchy
for file in migrations/*.sh; do
for file in ~/.local/share/omarchy/migrations/*.sh; do
filename=$(basename "$file")
migrate_at="${filename%.sh}"
# Migration already applied, to re-run it simply delete the state file and try again
[ -e "${STATE_DIR}/$filename" ] && continue
echo -e "\e[32m\nRunning migration (${filename%.sh})\e[0m"
source $file
touch "${STATE_DIR}/$filename"
if [[ ! -f "$STATE_DIR/$filename" ]]; then
echo -e "\e[32m\nRunning migration (${filename%.sh})\e[0m"
source $file
touch "$STATE_DIR/$filename"
fi
done
# Back to where we came from
cd - >/dev/null