Q:

foreign key mismatch - "app_uploadedfiles" referencing "app_uploadedfile"

This question doesn't answer to my problem.
Here are my classes:
class Person(BaseModel):
    user = models.OneToOneField(User, related_name='person',
                                on_delete=models.CASCADE)

class UploadedFile(BaseModel):
    description = models.CharField(max_length=200, default=None,
                                   null=True, blank=True,)
    original_file = models.CharField(max_length=200, default=None,
                                     null=True, blank=True,)
    uploaded_file = models.FileField(default=None, null=True, blank=True,)

class UploadedFiles(BaseModel):
    person = models.ForeignKey(Person, null=True, blank=True, default=None,
                               related_name='uploaded_files',
                               on_delete=models.CASCADE)
    common_directory = models.CharField(max_length=200, default=None,
                                        null=True, blank=True)
    tarball_file = models.ForeignKey(UploadedFile, null=True, blank=True,
                                     related_name='tarball_file',
                                     default=None,
                                     on_delete=models.CASCADE)

When, in my code I do this: 
UploadedFiles.objects.create(person=self.request.user.person)

I get this error:
sqlite3.OperationalError: foreign key mismatch - "app_uploadedfiles" referencing "app_uploadedfile"

What drives me nuts is that I've just done this on a blank new project and it works. Any idea how to solve this?

A:

What droves me nuts is that I've just done this on a blank new project and it worked!
My own solution has been to delete the whole database = delete the file then a makemigrations / migrate.

