Skip to content

Commit

Permalink
feat: adds a restore:noprompt task
Browse files Browse the repository at this point in the history
  • Loading branch information
Gowiem committed Nov 2, 2023
1 parent 41a8eea commit 4835245
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions lib/snaplet/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,31 @@ tasks:

restore:
desc: Restores the given RESTORE_SNAPSHOT to the SNAPLET_TARGET_DATABASE_URL database.
prompt: This will wipe all of the data in the given SNAPLET_TARGET_DATABASE_URL. Are you sure?
silent: true
vars:
RESTORE_OPTIONS: '{{.RESTORE_OPTIONS | default ""}}'
RESTORE_SNAPSHOT: '{{.RESTORE_SNAPSHOT | default "latest"}}'
SNAPSHOT_PATH: .snaplet/snapshots/{{.SNAPSHOT_ENV}}/{{.RESTORE_SNAPSHOT}}
requires:
vars:
- SNAPLET_TARGET_DATABASE_URL
cmds:
- printf "\n\n👋 Restoring snapshot from {{.SNAPSHOT_PATH}}\n"
- snaplet snapshot restore {{.SNAPSHOT_PATH}}
- snaplet snapshot restore {{.RESTORE_OPTIONS}} {{.SNAPSHOT_PATH}}
- printf "\n\n💯 Restored snapshot from {{.SNAPSHOT_PATH}}\n"

restore:noprompt:
desc: Restores the given RESTORE_SNAPSHOT to the SNAPLET_TARGET_DATABASE_URL database.
silent: true
vars:
RESTORE_SNAPSHOT: '{{.RESTORE_SNAPSHOT | default "latest"}}'
SNAPSHOT_PATH: .snaplet/snapshots/{{.SNAPSHOT_ENV}}/{{.RESTORE_SNAPSHOT}}
requires:
vars:
- SNAPLET_TARGET_DATABASE_URL
cmds:
- task: restore
vars:
RESTORE_OPTIONS: --yes
RESTORE_SNAPSHOT: "{{.RESTORE_SNAPSHOT}}"
SNAPSHOT_PATH: "{{.SNAPSHOT_PATH}}"

0 comments on commit 4835245

Please sign in to comment.