1

I dropped some table related to an app. and again tried the syncdb command

python manage.py migrate

It shows error like

django.db.utils.ProgrammingError: (1146, "Table 'homeapp_enroll_course' doesn't exist")

models.py

class Enroll_course(models.Model):
    SHFE_CHOICES = (
        ('M', 'Moring'),
        ('E', 'Evening'),
    )
    BATCH_CHOICES = (
        ("A", "1ST"),
        ("B", "2ND")
    )
    userinfo = models.ForeignKey(User, on_delete=models.CASCADE)
    course = models.ForeignKey(Course, on_delete=models.CASCADE)
    batch = models.CharField(max_length=1, choices=BATCH_CHOICES, default="A")
    shife = models.CharField(max_length=1, choices=SHFE_CHOICES, default="M")
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)
0

1 Answer 1

0

I think what happend is that you lost sync with the migration and the db.

Try to delete all the migration related to this table.

(If nothing improtant you can delete all migrations files in the specific app).

Then run python manage.py makemigrations - to create all the migrations again.

Then run python manage.py migrate

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.