'Django does not create foreign key in sqlite table [closed]
I use sqlite in a Django project. I created a model called Employee, and then Education, but I forgot to add a foreign key to Employee.
When I found the problem, I added the foreign key:
class Education(models.Model):
employee=models.ForeignKey(Employee, on_delete=models.CASCADE),
But when run manage.py makemigrations, it says nothing changed.
So I tried to delete the sqlite database file, delete all migrations and tried to create a new database. It still say nothing changed! the sqlite database file is created, with 0 size!
What is happening to django?
Solution 1:[1]
As Iain Shelvington pointed out, this is a mistake in code that line has extra comma. This is a frequent mistake for programmers of other languages when writing python :(
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | AIMIN PAN |
