Currently I have converted my python 2 project into python 3 project & earlier I was using Django version 1.9.13 & now I have updated it to 2.2.6.
Now I am able to run my project in latest version of python and django but when I run my project in cmd I have found that It showing message like You have 253 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s)...
so I have checked my migrations folder and able to find all migrations files there.
Any idea why I am getting such kind of message here & if it is bug then what should I do to get rid of such problem ?
Thanks.
Yes, you can just delete them from migrations folder (dont delete the migrations folder itself).
Solution for unapplied migration(s) To run the migrate comment: First, stop the Django server by pressing the keys CONTROL-C. Then run the comment python manage.py migrate in the same integrated terminal or a new one. Now you can see all the required migrations applied to the apps.
Deleting Django migrations is generally a bad idea. Django keeps track of what's in your db through these migration files, as well as through a table it creates in your db, and if you delete any of this Django will start throwing errors on migrate that can be hard to fix.
You need to migrate those migrations to your database. This means you have changes in your model classes but they are not applied to the database you are using. To migrate to the database: in CMD
python manage.py makemigrations
python manage.py migrate
In both cases, make sure you are inside your virtualenv (if you have one) and using the right python. For instance, in most cases if you have multiple pythons installed (2 and 3); you might have to use 'python3' in the above commands.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With