"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

5 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
2 Likes

add the app to the INSTALLED_APPS list

1 Like

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.

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.

after the make folder by migrations
my migrate command is not working
i did this all also flush database delete migrations folder but still not working
plz tell me solution plz

my database cannot migrate i have tried any means is still not working pls i need our help

database migration is not working

Welcome @Himselv16 !

If you are having an issue with which you are seeking assistance, I would suggest you open a new topic for it.

When you do so, please include all the relevant information.
Identify

  • the versions of Django and Python you are using
  • the database engine is being used
  • the commands you have issued to do this
  • all tracebacks and error messages you may have received
  • a brief description of your project’s directory structure
  • the INSTALLED_APPS section of your settings.py

Also, please do not post images of any of this information. Copy / paste it into the body of your post, surrounded between lines of three backtick - ` characters. (This means you’ll have a line of ```, then the code, error message, traceback, command line and output, etc, then another line of ```.)

INSTALLED_APPS = [
‘jazzmin’,

'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',

# Custom App
'hotel',
'user_dashboard',
'addon',
'userauths',

 #Third Part Apps
 'import_export',
 'crispy-forms',
 'mathfilters',
 'ckeditor_uploader',
 'django_ckeditor_5',
 'taggit',

django version==5.1

python version==3.12

python manage.py migrate
Traceback (most recent call last):
File “C:\Users\Emmanuel_coder\Desktop\hms\manage.py”, line 22, in
main()
File “C:\Users\Emmanuel_coder\Desktop\hms\manage.py”, line 18, in main
execute_from_command_line(sys.argv)
File “C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management_init_.py”, line 442, in execute_from_command_line
utility.execute()
File “C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management_init_.py”, line 416, in execute
django.setup()
File “C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django_init_.py”, line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File “C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\apps\registry.py”, line 91, in populate
app_config = AppConfig.create(entry)
^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\apps\config.py”, line 193, in create
import_module(entry)
File “C:\Users\Emmanuel_coder\AppData\Local\Programs\Python\Python312\Lib\importlib_init_.py”, line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “”, line 1387, in _gcd_import
File “”, line 1360, in _find_and_load
File “”, line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘import_export’

Welcome @Himselv123 !

If you are having an issue with which you are seeking assistance, I would suggest you open a new topic for it.

When you do so, please include all the information posted above.

Also, when you’re posting code here, enclose it between lines of three backtick - ` characters. This means you’ll have a line of ```, then the code, then another line of ```. (This forces the forum software to keep your code properly formatted.)