With commandbox-migrations, Is it possible to disa...
# box-products
p
With commandbox-migrations, Is it possible to disable
migrate down
? I rarely want to run
down
more than once, occasionally step back through a few migrations to fix something I've done wrong recently in development, but once it's been merged and deployed,
migrate down
doesn't make any sense to me and is just a database self destruct
maybe I'm missing a bigger picture here
but I use
box migrate up
on staging and production to apply changes
but in doing so,
box migrate down
is still there
b
It's there but you have to run it manually (unless you've put it in a script block or something?)
I guess all your down()'s could be wrapped in environment checks. I don't know of a way to just disable down() only (without changing module code)
🤔 1
p
it's only typing down instead of up though and then everything's gone
the environment check is a good idea, but I'd have to modify each existing migration and there's no guarantee everyone would remember to do it in future
b
I see pre and post processing callbacks on the up and down methods but don't see any way to get to those yourself. I think you're pretty much limited to updating them and using code reviews to enforce it.
another random though that I have not tried... you might be able to replace "migrate down" with a custom command (or command alias if you can figure out how to get a space into an alias) that just echos "Nope" instead of running it. Then just apply that command/alias to prod.
👍 1
p
Yeah that was my next idea too, I'll see if I can get an alias working