djangodjango-migrations

Django 3.0.7 - No Changes Detected after making Changes to Model


I am making changes to a model AppContactCnt to add new fields to handle deleting of records. Here is that models.py

class AppContactCnt(models.Model):
    id_cnt = models.AutoField(primary_key=True)
    # idcst_cnt = models.IntegerField()
    idcst_cnt = models.ForeignKey(AppCustomerCst, models.DO_NOTHING, db_column='idcst_cnt')
    idctp_cnt = models.ForeignKey(AppContactTypeCtp, models.DO_NOTHING, db_column='idctp_cnt')
    idtrp_cnt = models.IntegerField()
    name_cnt = models.CharField(max_length=50)
    phone_cnt = models.CharField(max_length=50, blank=True, null=True)
    email_cnt = models.CharField(max_length=100, blank=True, null=True)
    note_cnt = models.CharField(max_length=100, blank=True, null=True)
    receives_emails_cnt = models.BooleanField(blank=True, null=True)
    deleted_cnt = models.BooleanField(blank=True, null=True)
    # date_deleted_cnt = models.DateTimeField(blank=True, null=True)
    # deleted_by_cnt = models.CharField(max_length=100, blank=True, null=True)

    class Meta:
        db_table = 'app_contact_cnt'
        app_label = 'easytrade20'

I tried to add in managed = True no change.

Also tried the following: Delete all previous migration files and pycache files except init.

python manage.py migrate --fake-initial
python manage.py makemigrations
python manage.py migrate

I am still getting No changes detected

I am not sure how to proceed, any assistance is apprecaited.


Solution

  • You have set app_label = 'easytrade20' in the meta option, but Django is unable to detect an app named easytrade20 in your project. That's why there aren't any changes.

    So, add easytrade20 to your INSTALLED_APPS or remove app_label = 'easytrade20' from the model's Meta, and try again to run your migrations.