Files
music_library/scripts/prod/backup
T
Claudio Ortolina c513c43a52 Ensure working directory in scripts
So that they can be run standalone and not just through Mise
2025-10-07 10:30:38 +03:00

21 lines
624 B
Bash
Executable File

#!/usr/bin/env bash
#MISE description="Backup the production database to the local development env"
set -e
source "$(dirname "$0")/../_helpers.sh"
ensure_working_directory!
current_date=$(date +%s)
project_dir=$(git rev-parse --show-toplevel)
data_dir="$project_dir/data"
dest_file="$data_dir/music_library_prod_$current_date.db"
scp music-library-prod:/data/coolify/applications/music-library/music_library_prod.db "$dest_file"
rm "$data_dir/music_library_dev.db" || true
rm "$data_dir/music_library_dev.db-shm" || true
rm "$data_dir/music_library_dev.db-wal" || true
cp "$dest_file" "$data_dir/music_library_dev.db"