Open ryanhiebert opened 11 months ago
We could start with the the basics:
before_deploy
after_deploy
Those are good places to start, and it's going to have to be OK to not include all the possibilities. There are some that we'll miss, but there are some that we can't discover.
With the pre-commit hook now merged, it makes me wonder how to implement this. Autodiscovery would be about impossible to detect in a hook remotely similar to the one we have if the property is not included in the migration. One possibility might be to override or have a custom makemigrations
command that includes it. It feels like we may have suggested that previously, but that sounds like a good way to enable autodiscovery.
It might even open things up for automatically splitting a new migration into two where we notice that some are before_deploy
and some are after_deploy
.
Much of the time I'm able to easily determine what the safe property of a migration should be. Some categories of operations are so clear that we should be able to discover it algorithmically. There are certainly limitations to what can be automatically discovered, and I'm not sure how it should interplay with the default. Or if it's even worthwhile. But it keeps coming up in my mind and I wanted to create an issue here as a place to collect thoughts on the idea.