Skip to content

Commit 6de8f1e

Browse files
committed
added --revert-ok flag
1 parent 433937b commit 6de8f1e

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
@@ -141,6 +141,7 @@ func main() {
141141
target := flag.Int("to", CurrentVersion, "specify version to upgrade to")
142142
yes := flag.Bool("y", false, "answer yes to all prompts")
143143
version := flag.Bool("v", false, "print highest repo version and exit")
144+
revertOk := flag.Bool("revert-ok", false, "allow running migrations backward")
144145

145146
flag.Parse()
146147

@@ -166,6 +167,11 @@ func main() {
166167
os.Exit(1)
167168
}
168169

170+
if vnum > *target && !*revertOk {
171+
fmt.Println("ipfs migration: attempt to run backward migration\nTo allow, run this command again with --revert-ok")
172+
os.Exit(1)
173+
}
174+
169175
if vnum == *target {
170176
fmt.Println("ipfs migration: already at target version number")
171177
return

0 commit comments

Comments
 (0)