Skip to content

Commit 87985f2

Browse files
jbenetStebalien
authored andcommitted
added --revert-ok flag
1 parent aab1974 commit 87985f2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ func main() {
145145
target := flag.Int("to", CurrentVersion, "specify version to upgrade to")
146146
yes := flag.Bool("y", false, "answer yes to all prompts")
147147
version := flag.Bool("v", false, "print highest repo version and exit")
148+
revertOk := flag.Bool("revert-ok", false, "allow running migrations backward")
148149

149150
flag.Parse()
150151

@@ -170,6 +171,11 @@ func main() {
170171
os.Exit(1)
171172
}
172173

174+
if vnum > *target && !*revertOk {
175+
fmt.Println("ipfs migration: attempt to run backward migration\nTo allow, run this command again with --revert-ok")
176+
os.Exit(1)
177+
}
178+
173179
if vnum == *target {
174180
fmt.Println("ipfs migration: already at target version number")
175181
return

0 commit comments

Comments
 (0)