[Answered ]-Should I be adding the Django migration files in the .dockerignore /.gitignore file?

1๐Ÿ‘

โœ…

No. The migration files are there so you can update your database without destroying it and rebuilding it from scratch (or doing the sql update statements by hand).

So you definitely want to track them in your version control.

During development, a classic scenario would be

  1. write code
  2. make migrations
  3. apply migrations on your dev database
  4. test the changes locally
  5. check in and push the commit to your production server
  6. execute the migrations (so only do python manage.py migrate) in production

Edit: I forgot to answer your docker question. Usually you put your source code in a volume outside the container, that you then mount into the container. So you can do docker development like this. That way the migration files and up in your codebase and you can track it.

๐Ÿ‘คtimovdw

Leave a comment