16 | | So, my code should be correct by using `self.get_changes([Readable], [Readable with no fields, Book])` (I will use predefined model states later!). but my code meant to fix this issue wasn't executed when I use `self.get_changes` while doing two separate migrations will execute my added code correctly, which is confusing. Also I suspect that the first migration will construct a `loader.graph` that will reorder the action operations. |
17 | | |
18 | | Sorry about the confusion! So basically using `self.get_changes([Readable], [Readable with no fields, Book])` doesn't give me the action operations with the correct order. When I do the first migration for only `Readable` class, and then the second migration for `Readable` with no fields, `Book` and `Magazine` on local machine, it gives me the correct order. So i don't think simply doing `self.get_changes` will do the same thing as my mentioned two-step migrations testing. So I just can't find out what is the causation... |
19 | | |
20 | | Here is the error message I have: |
21 | | |
22 | | |
23 | | {{{ |
24 | | app: |
25 | | auto_1 |
26 | | <CreateModel name='Book', fields=[('title', <django.db.models.fields.CharField>), ('name', <django.db.models.fields.CharField>)], options={}, bases=('app.Readable',), managers=[]> |
27 | | <RemoveField model_name='readable', name='name'> |
28 | | <RemoveField model_name='readable', name='title'> |
29 | | }}} |
30 | | |
31 | | And `RemoveField` should be executed before `CreateModel`. |
32 | | |
33 | | I have tried to see why it doesn't work the same way as when i do two migrations separately. I think i must have the first migration loaded in the `graph`, and then create autodetector by using before state, after state as well as the graph loaded from the first migration. but I'm not sure how to do that... |
| 16 | After I spent hours and hours on this, I found out keyword tuples `(app_label_name, name)` are supposed to be lower case when we access it using `self.from_state.models` and `self.from_state.models`... |