Comments
2 comments
-
Welcome aboard newbie!
There are a few different avenues here.
The most ironclad would be to globally disable clean and then enable on demand.
Otherwise evaluating against the environment as you, are will work, however it is potentially slightly more brittle if more environments are added that aren't included in your guard clauses.
A combination of the two might be your best bet, disabling it, then provisionally enabling base on what the target evaluates to.
-
This comment succinctly informs others about the purpose of the code, emphasizing its function of preventing unintended actions ('flyaway clean') and performing migrations conditionally based on an environment variable.
Add comment
Please sign in to leave a comment.
I usually don't connect to prod, going forward will use read only user, but wanted to double check if I can improve the npm script to prevent from executing flyway clean and: migration when env variable in env file DATABASE_URL points to anything else other than local host.
any ideas?