Sometime during the last year I started running into an error when I ran makemigrations and migrate. After some investigation I arrived at the work-around to run these with --skip-checks to essentially ignore the errors since everything seemed to work.
Except tests, I recently learned, since to my knowledge there was no way to add --skip-checks to the django test runner without some custom code. And it started to seem like I was now having to go out of the way to make things work which seemed to indicate some deeper misunderstanding.
So I went back to the views where the errors were getting thrown and it seemed that all were related to the creation of a FilterSet class to use in a TableView. Specifically I was trying to use list comprehensions in place of a queryset. In my defense I don’t recall knowing about a ModelChoiceFilter when I first wrote the code. I was able to address all of the no such table OperationErrors that were thrown during makemigrations or migrate by performing a code change similar to that shown in the screenshot of a diff below:
Essentially resolving the issue came down to some debugging: For each error where I saw “no such table” I identified the source code and made a change that would explicitly call out a model.
The errors seemed to be entirely addressed by these changes (I made about 3+ changes - all to sub-classes of the FilterSet class.
So for the example shown in the visual diff image attached, I was creating an AssetFilter(FilterSet) class that relied on the Asset model. migrate would complain that the organization table did not exist. I replaced what I thought was a generated list of Organization Ids and Names implemented as a ChoiceFilter with a ModelChoiceFilter set to the queryset of the Organization model manager.