how to create multiple migrations in unit testing in ``

I added some code to handle a reported bug. but I’m struggling to find a way to create two migrations that are associated with each other in unit testing.

there is a function called self.get_changes() in It only does one migration at a time. Let’s say initially, I want to create one migration that creates a model. This can be done by using self.get_changes([], [new_model_project_state]), but simply using this function will not add second migration. How can I create a second migration that removes some fields out of the model in the first migration, and create inheriting models that depend on the model in the first migration? I am trying to test it, and I have spent all day long figuring out how to do so.

the issue Im working on
btw, this is my first open-source issue, and i think I’m getting closer and closer!

Hi @nanliu, I’ve replied on the ticket. Hope that helps.

hi @adamchainz,

Sorry about the confusion! So basically using self.get_changes([Readable], [Readable with no fields, Book, Magazine]) 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 using command python makemigrations 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 the reason

Hi Adam,

Thank you for your help! I was able to solve the issue, and started a pull request. do you know when people are gonna look at the pull request? if it is accepted, i may gain some extra credits for my assignment as well. in addition, i would definitely keep contributing to the project!

Appreciate your eagerness, but please keep conversation in one place in future (on the ticket).