CLI: hasura migrate apply --down
could validate the argument value and abort if it's absurdly big
#8740
Labels
c/cli
Related to CLI
k/enhancement
New feature or improve an existing feature
t/native-dbs
t/product-platform
Is your proposal related to a problem?
Recently I meant to run this command:
But recalling the flags from memory, I accidentally ran this command instead:
This was interpreted as wanting to go down N migrations where N =
1659058116550
. I think it's safe to assume that is never what the operator intended.Luckily, this was in a dev environment. That's actually why I didn't use
--dry-run
first. But it still caused a headache. Even though I killed the command after 5 or 10 seconds (when I realized what was going on), it had time to get the database into an invalid state. (And not just a state of bad migrations. It was apgaudit stack is not empty
error. But since it was just a dev database, I was able to roll back a day then just the correct migration commands and things were fine.)Human errors are inevitable and these flags can be confused, so I think this is a good opportunity for some validation.
Describe the solution you'd like
Perhaps
--down
1 could have a guard on this number, and if it's above some threshold it would require confirmation. The number could be, say, the seconds-since-the-epoch when the Hasura project was started.Describe alternatives you've considered
(Easier for me to phrase as questions)
If the feature is approved, would you be willing to submit a PR?
Yes.
Footnotes
(... and perhaps
--up
but the impact would be smaller, since there won't be so many up-migrations that could be applied) ↩The text was updated successfully, but these errors were encountered: