Split revisions by op #1398
-
Hi I'm looking to split revisions by op due to scaling issues. For instance:
Should be split into two files. Guidance would be great! Currently, I just use a pytest to check migration files using ast. I feel like this would be harder as a post-migration step trying to match downgrade operations with upgrade operations. Actually, question: for every upgrade operation, is there a parallel downgrade function? If the number of operations per function is the same, then I can go about it like that. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi, That's a strange request, I'm not sure if there is something that can do that automatically. |
Beta Was this translation helpful? Give feedback.
I would say that in most cases you could assume that.
The only cases that I can think of would be an add table with complex fk/index/etc that can't be added inline requiring multiple operations to create and only a drop table to undo. But I'm not sure autogenerate will generate that or create a single create_table even in this case.
this may not be the only instance though.
I guess add an assert that len(upgrade_ops) == len(downgrade_ops) and see how far you get