I just got the same error, but referring to a model that was declared as part of the same migration. It turned out that the first migrations.CreateModel(...)
referred to a not yet declared model. I manually moved this below the declaration of the referred model and then everything worked fine.