Spaces:
Sleeping
Sleeping
Download scripts/migrate.sh from arcsu1/portfolio_workers: direct link, hf CLI and curl.
- Browser
- Download file 839 Bytes
-
https://huggingface.co/spaces/arcsu1/portfolio_workers/resolve/main/scripts/migrate.sh
- Command line
-
hf download hf://spaces/arcsu1/portfolio_workers/scripts/migrate.sh
-
curl -L -o migrate.sh https://huggingface.co/spaces/arcsu1/portfolio_workers/resolve/main/scripts/migrate.sh
839 Bytes
| set -eu | |
| cd "$(dirname "$0")/.." | |
| current_output=$(alembic current) | |
| latest_output=$(alembic heads) | |
| extract_revisions() { | |
| printf '%s\n' "$1" | awk ' | |
| $1 ~ /^[[:alnum:]_]+$/ && $1 != "Current" && $1 != "none" { | |
| print $1 | |
| } | |
| ' | sort -u | |
| } | |
| current_revisions=$(extract_revisions "$current_output") | |
| latest_revisions=$(extract_revisions "$latest_output") | |
| if [ -z "$latest_revisions" ]; then | |
| echo "Unable to determine the latest Alembic revision." >&2 | |
| exit 1 | |
| fi | |
| if [ "$current_revisions" = "$latest_revisions" ]; then | |
| echo "Database is already at the latest migration ($current_revisions)." | |
| exit 0 | |
| fi | |
| echo "Database is not at the latest migration." | |
| echo "Current revision(s): ${current_revisions:-none}" | |
| echo "Latest revision(s): $latest_revisions" | |
| exec alembic upgrade head | |