Some checks failed
CI / skip-ci-check (pull_request) Successful in 1m4s
CI / lint-and-type-check (pull_request) Has been cancelled
CI / python-lint (pull_request) Has been cancelled
CI / test-backend (pull_request) Has been cancelled
CI / build (pull_request) Has been cancelled
CI / secret-scanning (pull_request) Has been cancelled
CI / dependency-scan (pull_request) Has been cancelled
CI / sast-scan (pull_request) Has been cancelled
CI / workflow-summary (pull_request) Has been cancelled
Add on-demand H.264/AAC web playback (RQ, ffmpeg) with API routes and Next.js proxies; extend admin UI with WebPlaybackVideo and shared hooks. Store transcode cache beside pending-photos (WEB_VIDEO_CACHE_DIR / UPLOAD_DIR) and ignore data/web_videos. Centralize FastAPI URL helpers, optional Vite and Next base paths for subfolder deploy, and fix modal reopen by using router.replace when closing the home photo viewer. Include migration, install scripts, deployment doc updates, and CI admin build env tweak. Made-with: Cursor
42 lines
954 B
Bash
Executable File
42 lines
954 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Run a SQL migration against the main DATABASE_URL from repo .env.
|
|
#
|
|
# Usage (from anywhere):
|
|
# ./scripts/run-psql-migration.sh migrations/add-photos-web-playback-columns.sql
|
|
#
|
|
# Strips SQLAlchemy driver suffixes (+psycopg2, +asyncpg) so psql accepts the URL.
|
|
# For remote Postgres, set DATABASE_URL in .env to postgresql://user:pass@host:port/dbname
|
|
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cd "$ROOT"
|
|
|
|
if [[ ! -f .env ]]; then
|
|
echo "ERROR: .env not found at $ROOT/.env" >&2
|
|
exit 1
|
|
fi
|
|
|
|
set -a
|
|
# shellcheck disable=SC1091
|
|
source .env
|
|
set +a
|
|
|
|
if [[ -z "${DATABASE_URL:-}" ]]; then
|
|
echo "ERROR: DATABASE_URL is not set in .env" >&2
|
|
exit 1
|
|
fi
|
|
|
|
SQL_FILE="${1:?Usage: $0 path/to/migration.sql}"
|
|
|
|
if [[ ! -f "$SQL_FILE" ]]; then
|
|
echo "ERROR: SQL file not found: $SQL_FILE" >&2
|
|
exit 1
|
|
fi
|
|
|
|
URL="$DATABASE_URL"
|
|
URL="${URL//+psycopg2/}"
|
|
URL="${URL//+asyncpg/}"
|
|
|
|
exec psql "$URL" -f "$SQL_FILE"
|