6.2. Solving migration errors

The steps described in this article were developed for this commit. It took a long time to arrive at this solution. So now that you’re here: it’s not because you’re stupid!

6.2.1. Scenario:

You try to migrate using our scripts/makemigrations.sh and scripts/migrate.sh scripts. When you run makemigrations.sh, everything is fine and you get a list of (external) apps for which updates exist:

Output of makemigrations.sh

But when you run migrate.sh, you get the following error message:

Output of migrate.sh

6.2.2. Solution:

  • Locate the Python packages corresponding to the Django apps that are listed by makemigrations.sh.

  • Find the entries (and therefore the versions) of the packages in our configurations/python-requirements. In the images above, the affected packages are cmsplugin-filer, django-filer (not sure if both are needed… if in doubt, just upgrade all candidates) djangocms-googlemap, djangocms-inherit and djangocms-link.

  • Search for the packages on PyPI and get the newest version.

  • Update python-requirements.txt to the new values.

    Always use == to indicate versions, never use >= !

    Reason: Package upgrades might break our images. So if external package A is updated and the new version would break our build, we don’t notice this. But when somebody tries to build our docker image at some point in the future, the build fails, although it has always worked before! Then it’s difficult to find the correct package version that were in use at the time when the dependency was added/updated.

  • Rebuild the image; the following code should be run in the parent directory that contains all code:

    docker-compose build
    
  • Actually perform the migrations:

    scripts/makemigrations.sh
    scripts/migrate.sh
    
  • Don’t forget to update the table of our dependencies!