dotfiles/bin/import-gzip-database

18 lines
310 B
Plaintext
Raw Normal View History

2023-04-16 19:54:20 +00:00
#!/usr/bin/env bash
if [[ "$1" == "" ]]; then
echo "Usage: ${0##*/} <filename>"; exit 2
fi
set -euo pipefail
filename="${1}"
shift 1
pv "${filename}" \
| zcat \
| docker compose exec -T "${SERVICE_NAME:-database}" mysql \
2023-04-16 19:54:20 +00:00
-p"${DB_PASSWORD:-app}" \
-u"${DB_USER:-app}" \
"${DB_NAME:-app}"