"No migrations to apply" when run migrate after makemigrations

Hello developers,

I created a new table in modal.py

class CustomerInfo(models.Model):
    customer_name = models.CharField(max_length=255 , default=False)
    id_no = models.CharField(max_length=255 , default=False)
    mobile_no = models.CharField(max_length=255 , default=False)
    email = models.CharField(max_length=255 , default=False)
    status = models.IntegerField(default=False)

    class Meta:
        db_table = 'customer_info'

Creation of migrations returns:

Migrations for 'sms_setting':
  sms_setting\migrations\0008_customerinfo.py
    - Create model CustomerInfo

and then when I did migrate, there is no migrations to apply

Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions, sms_setting
Running migrations:
  No migrations to apply.

What am I doing wrong ? Has anyone ever had this problem?

If you make migrations for the first time since deleting your previous migrations, it doesn’t need to migrate anything new. This is normal. Run your server now and it should be fine…otherwise you can completely reset the database.

If you want to reset the database and recreate the auth_user table like what you would do when you set up your project at the very beginning, then either do:
python manage.py flush to reset the database entirely, or delete the db.sqlite3 file and it will re-generate itself again. If you do this, you will need to make the superuser again with python manage.py createsuperuser

django save its migration info in django_migrations table so you have to delete that recorde from there too.

also deleting migrations is not recommended. use squash migration

2 Likes

Hi @Shathamhb , sometimes that happens to me(I don’t know why).

You can try running migrate command only for the app.

python manage.py migrate sms_setting
1 Like

add the app to the INSTALLED_APPS list

Welcome @Imohraz

The original post shows that a makemigration has created a migration file. This shows that the app would already be in the INSTALLED_APPS list.