I am trying to change some field names of Django models, but for some reasons Django does not want to see my migrations. I made sure the following things are properly set up:
myApp.apps.MyAppConfig
is added toINSTALLED_APPS
in settings.py- A migration folder with an empty
__init__.py
is present in my app folder - In myApp folder, I also have an empty
__init__.py
The whole procedure works just fine locally with a SQLite database and I can change field names and run python manage.py makemigrations
and python manage.py migrate
to migrate the database. However in production where I use Docker Compose for orchestration and Postgres as database only the first migration works fine. Afterwards when I change any model field name and try to run docker-compose exec projectname django-admin makemigrations
or docker-compose exec projectname python manage.py makemigrations
or add the app name behind these commands nothing helps.
Then Postgres can't handle the request, because it doesn't know the new field name:
2022-03-11 14:40:22.136 UTC [81] ERROR: column model_name.new_field_name does not exist at character 357
What am I missing here? How can I get Django to migrate?