79120260

Date: 2024-10-24 03:25:35
Score: 0.5
Natty:
Report link

Today, I have faced exactly same problem and the solution was similar to @nealium . I am writing here for future reference for others. (ChatGPT was not able to solve with there list of 9-10 possibilities or may be i was not able to write good prompt).

  1. Connect to your postgress sudo -u postgres psql
  2. Connect to your DB , example, books. psql$ \connect books
  3. Check all tables just to verify. \dt
  4. Now check django_migrations table. SELECT * from django_migrations; it will tells what are migrations that are applied and if your migration for the app is there then manange.py migrate app_name will have no effect as explained in the question.
  5. Either delete the row/s mentioning the same migrations number for the app, for example, 0001_ for app_name. DELETE FROM django_migrations WHERE app = 'author'; it will delete all applied migrations created for app name 'author' and you can continue with new makemigrations and migrate OR
  6. Delete the table migrations table , NOTE : only when it is a development stage and not much data or features have been added.
Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • User mentioned (1): @nealium
  • Low reputation (1):
Posted by: Ajit kumar