excellent_migrations
excellent_migrations copied to clipboard
Architecture of detectors
It's a good idea to tackle complexity of finding unsafe operations – to make them easier to read, understand, maintain and develop. There two aspects:
- there are many checks
- some checks are compound – they need to check conditions on multiple lines (e.g. index added concurrently and lock disabled)
Possible approach is to make AstParser
return relevant parts of code (not yet detected unsafe operations). Then add another step to the process that would decide about dangers (based on that data from AstParser
).
I like this approach, because it would decompose the logic into separate, independent steps with different responsibilities.
The question is: will this approach be suitable for all cases, including detecting irreversible migrations.
We've already had some discussion about it with @hiagomeels here.