Search code examples
postgresqldockeropenproject

How to migrate openproject database from Postgresql v9.4 to v9.6 within a docker installation?


I'm trying to update my OpenProject from v7.0 to v8.0 using the new Docker image.Everything went well till I try to import the database. The new version uses Postgresql v9.6 which is incompatible with the former Postgresql v9.4. There is a good guide on the OpenProject website on how to migrate to Postgresql v9.6: https://www.openproject.org/operations/upgrading/openproject-postgresql-migration-guide-9-6/ . But it covers only the linux installation.

How is it possible to migrate the OpenProject database from Postgresql v9.4 to v9.6 within docker ?


Solution

  • Finally a solution is found. Here are the general steps for the migration:

    • Create the database backup of the current installation:

      1. Connect to the old Container v7.0
      2. Stop the running services, except postgers, via supervisorctl stop < service_name >
      3. Create the dump of the database with the name "openproject"
      4. Exit the container and copy the created dump outside it
    • Restore the database into a the new installation:

      1. Copy the former created dump inside the new container v8.0
      2. Connect to the new Container v8.0
      3. Stop the running services, except postgers, via supervisorctl stop < service_name >
      4. Connect to the postgresql database server and delete the database "openproject"
      5. Create a new "openproject" database and assign it to the user "openproject"
      6. Restore the openproject database using the dump file
      7. Exit and restart the container

    OpenProject system will automatically recognize the old database structure and will migrate the tables to match the new version.

    I hope this will help someone