Installing and upgrading the PostgreSQL database

This section describes the steps to download the latest version of PostgreSQL database and configure the computer running the EPO project.

Prerequisites:

  • A Microsoft Windows computer with Power Operation installed.
  • A Windows user account with the same credentials as a PostgreSQL account with Administrator privileges.
  • The current PostgreSQL database has been backed up.
  • The EPO project has been stopped.
  • The new PostgreSQL version compatibility with the Windows operating system has been confirmed with current Operating System (32-bit or 64-bit). This information is available on the official PostgreSQL site: https://www.postgresql.org/

To setup the computer:

  1. Download the latest PostgreSQL version from the official PostgreSQL site:

    https://www.postgresql.org/download/

  2. Install the new version of the PostgreSQL database through the installation wizard.
  3. Navigate to the postgreSQL.conf file and change the port number from 5432 to 5433. The postgresql.conf file can be found in the following directory: ..\ProgramData\SchneiderElectric\PowerOperation\v2022\database/postgresSQLconf _hba.conf
  4. NOTE: Step 3 can also be performed through the Installer utility. Click Next to go through the installation procedure. Port 5432 is used by the current version of PostgreSQL. Thus, the port number is updated in Step 4.

     
  5. From the Services application, start the new PostgreSQL version service (postgresql-x64-14).
  6. Open the PostgreSQL shell (psql) interface.
  7. Test and verify both PostgreSQL versions are running with the following PostgreSQL command: Select Version(), inet_server_port ();

Upgrade the PostgreSQL version

This section describes the steps to upgrade the PostgreSQL version in the computer running the EPO project.

Prerequisites:

  • Give full control permission to the PostgreSQL installation folder.
  • Save the folder paths needed to run the compatibility check commands. For example:
  • Folder Path
    Oldconfigdir ..:\ProgramData\Schneider Electric\Power Operation\v2021\database
    reconsider ..:\Program Files\PostgreSQL\14\data
    ordinaire ..:\Program Files\PostgreSQL\bin
    nonbinder ..:\Program Files\PostgreSQL\14\bin

To upgrade the PostgreSQL version in the computer running EPO:

  1. In the Services application or command prompt, stop both the old (postgresql-x64-13) and new (postgresql-x64-14) versions of PostgreSQL services.
  2. In the pg_hba.conf file, update the authentication method to ‘trust’.
  3. Login with the administrator account with the same credentials as the PostgreSQL administrators’ account.
  4. From Windows Command prompt, run a compatibility check using the following command:
    pg_upgrade -b oldbindir -B newbindir -d oldconfigdir -D newconfigdir -U postgres -c For example: pg_upgrade -d "C:\ProgramData\Schneider Electric\Power Operation\v2022\database" -D "C:\Program Files\postgreSQL\14\data" -b "C:\Program Files\postgreSQL\bin" -B "C:\Program Files\postgreSQL\14\bin" -U postgres -c
  5. Proceed to the next step if the compatibility check is successful.
  6. Run the pg-upgrade command from the latest version:
    pg_upgrade -b oldbindir -B newbindir -d oldconfigdir -D newconfigdir -U postgres For example: pg_upgrade -d "C:\ProgramData\Schneider Electric\Power Operation\v2022\database" -D "C:\Program Files\postgreSQL\14\data" -b "C:\Program Files\postgreSQL\bin" -B "C:\Program Files\postgreSQL\14\bin" -U postgres
  7. Start the new version of PostgreSQL when the upgrade is completed.
  8. Start the new version of PostgreSQL when the upgrade is completed.
  9. In the pg_hba.conf file, revert the authentication method to the original value of scram_sha_256.
  10. Refer the Configuring EPO to use the new version of PostgreSQL database section for additional steps required.