mirror of
https://github.com/fleetdm/fleet
synced 2026-05-20 07:29:08 +00:00
If this script is added as the `post-checkout` git hook, if the branch you're switching to has different migrations from the one you're coming from, it will automatically dump the current db, and restore the dump from the last time you visited this branch. If no dump exists, it just leaves the DB as-is
4 lines
285 B
Bash
Executable file
4 lines
285 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
BACKUP_NAME="${1:-backup.sql.gz}"
|
|
docker run --rm --network fleet_default ${FLEET_MYSQL_IMAGE:-mysql:8.0.36} bash -c "mysqldump -hmysql -uroot -ptoor --default-character-set=utf8mb4 --add-drop-database --databases fleet | gzip -" > "$BACKUP_NAME"
|