Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

' No migrations to apply' after Django migration

I made a new app called 'contact' which I added to installed_apps, but I can't create a table in the SQLite database!

Django version = 3.1

python manage.py makemigrations contact

No changes detected in app 'contact'

then for : python manage.py migrate contact

Operations to perform: Apply all migrations: (none) Running migrations: No migrations to apply.

I have tried many solutions proposed by members here but None worked

like checking "init" file existed in migrations folder and it's empty or commands like these :

python manage.py migrate --fake contact zero

Operations to perform: Unapply all migrations: contact Running migrations: No migrations to apply.

python manage.py migrate contact --fake-initial

Operations to perform: Apply all migrations: (none) Running migrations: No migrations to apply.

like image 722
mr.m Avatar asked Sep 06 '25 03:09

mr.m


1 Answers

This worked for me;

python manage.py makemigrations --empty yourappname

python manage.py migrate yourappname

It turns out adding an extra empty migration forces django to recheck the table and in the process, it noticed the new migrations. There's probably some caching taking place somewhere.

Original answer

like image 117
mr.m Avatar answered Sep 07 '25 21:09

mr.m