Skip to content

Commit 4835245

Browse files
committed
feat: adds a restore:noprompt task
1 parent 41a8eea commit 4835245

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

lib/snaplet/Taskfile.yaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,31 @@ tasks:
121121

122122
restore:
123123
desc: Restores the given RESTORE_SNAPSHOT to the SNAPLET_TARGET_DATABASE_URL database.
124-
prompt: This will wipe all of the data in the given SNAPLET_TARGET_DATABASE_URL. Are you sure?
125124
silent: true
126125
vars:
126+
RESTORE_OPTIONS: '{{.RESTORE_OPTIONS | default ""}}'
127127
RESTORE_SNAPSHOT: '{{.RESTORE_SNAPSHOT | default "latest"}}'
128128
SNAPSHOT_PATH: .snaplet/snapshots/{{.SNAPSHOT_ENV}}/{{.RESTORE_SNAPSHOT}}
129129
requires:
130130
vars:
131131
- SNAPLET_TARGET_DATABASE_URL
132132
cmds:
133133
- printf "\n\n👋 Restoring snapshot from {{.SNAPSHOT_PATH}}\n"
134-
- snaplet snapshot restore {{.SNAPSHOT_PATH}}
134+
- snaplet snapshot restore {{.RESTORE_OPTIONS}} {{.SNAPSHOT_PATH}}
135135
- printf "\n\n💯 Restored snapshot from {{.SNAPSHOT_PATH}}\n"
136+
137+
restore:noprompt:
138+
desc: Restores the given RESTORE_SNAPSHOT to the SNAPLET_TARGET_DATABASE_URL database.
139+
silent: true
140+
vars:
141+
RESTORE_SNAPSHOT: '{{.RESTORE_SNAPSHOT | default "latest"}}'
142+
SNAPSHOT_PATH: .snaplet/snapshots/{{.SNAPSHOT_ENV}}/{{.RESTORE_SNAPSHOT}}
143+
requires:
144+
vars:
145+
- SNAPLET_TARGET_DATABASE_URL
146+
cmds:
147+
- task: restore
148+
vars:
149+
RESTORE_OPTIONS: --yes
150+
RESTORE_SNAPSHOT: "{{.RESTORE_SNAPSHOT}}"
151+
SNAPSHOT_PATH: "{{.SNAPSHOT_PATH}}"

0 commit comments

Comments
 (0)