|
| 1 | +--- |
| 2 | +title: Upgrading a 3DCityDB |
| 3 | +description: Upgrading a 3DCityDB to a new minor or patch version |
| 4 | +tags: |
| 5 | + - 3dcitydb |
| 6 | + - upgrade |
| 7 | + - update |
| 8 | +--- |
| 9 | + |
| 10 | +Each 3DCityDB `v5` release comes with upgrade scripts that allow you to update an existing 3DCityDB instance to the latest |
| 11 | +release version. The recommended method for upgrading is to use the `upgrade-db` shell script included in the 3DCityDB |
| 12 | +software package. General information on where to find and how to execute the 3DCityDB shell scripts is |
| 13 | +available [here](db-scripts.md#shell-scripts). |
| 14 | + |
| 15 | +!!! note |
| 16 | + The upgrade scripts are intended **only** for minor and patch version updates within the same major version. |
| 17 | + |
| 18 | +!!! warning |
| 19 | + The upgrade may involve schema changes. Because this affects the stored city model data, we **strongly recommend backing |
| 20 | + up your 3DCityDB instance before upgrading**. |
| 21 | + |
| 22 | +## 3DCityDB upgrade steps |
| 23 | + |
| 24 | +### Step 1: Edit the `connection-details` script |
| 25 | + |
| 26 | +Navigate to the `3dcitydb/postgresql/shell-scripts` directory where you have unzipped the 3DCityDB software package, |
| 27 | +or locate the same folder in the installation directory of `citydb-tool`. Make sure you are using the scripts from the |
| 28 | +latest release version you want to upgrade to. Then, change to the subfolder `unix` or `windows`, depending on your |
| 29 | +operating system. |
| 30 | + |
| 31 | +In this directory, locate the `connection-details.[sh|bat]` script and open it in a text editor of your choice. Enter the |
| 32 | +connection details for the 3DCityDB instance you wish to upgrade, along with the full path to the `psql` |
| 33 | +executable in this file. See [here](db-scripts.md#shell-scripts) for more details. |
| 34 | + |
| 35 | +### Step 2: Run the `upgrade-db` script |
| 36 | + |
| 37 | +After setting the connection details, execute the `upgrade-db.[sh|bat]` script in the same folder to begin the upgrade |
| 38 | +process. You can either double-click the script or run it from a shell environment. On UNIX/Linux machines, you may |
| 39 | +first need to set the appropriate file permissions to make the script executable. |
| 40 | + |
| 41 | +=== "Linux" |
| 42 | + |
| 43 | + ```bash |
| 44 | + chmod u+x upgrade-db.sh |
| 45 | + ./upgrade-db.sh |
| 46 | + ``` |
| 47 | + |
| 48 | +=== "Windows CMD" |
| 49 | + |
| 50 | + ```bat |
| 51 | + upgrade-db.bat |
| 52 | + ``` |
| 53 | + |
| 54 | +You can also specify an alternative `connection-details` file from a different directory: |
| 55 | + |
| 56 | +=== "Linux" |
| 57 | + |
| 58 | + ```bash |
| 59 | + ./upgrade-db.sh /path/to/connection-details.sh |
| 60 | + ``` |
| 61 | + |
| 62 | +=== "Windows CMD" |
| 63 | + |
| 64 | + ```bat |
| 65 | + upgrade-db.bat C:\path\to\connection-details.bat |
| 66 | + ``` |
| 67 | + |
| 68 | +After launching the script, a welcome message and usage information will appear in the console. The script will then |
| 69 | +prompt you for the database password to connect to the 3DCityDB instance. |
| 70 | + |
| 71 | +!!! warning |
| 72 | + The upgrade process begins immediately after you enter the password — there is no confirmation or 'Are you sure?' prompt. |
| 73 | + |
| 74 | +### Step 3: Upgrade process |
| 75 | + |
| 76 | +The upgrade script first checks the version of your existing 3DCityDB instance to determine if an automatic upgrade to the |
| 77 | +target version is supported. Minor and patch upgrades within the same major version are generally supported. For major |
| 78 | +version upgrades, special migration steps are usually required. If an automatic upgrade is not possible, the process |
| 79 | +will abort with an error message and will not modify your existing database. |
| 80 | + |
| 81 | +If the version check passes, the script proceeds to apply all necessary changes to bring the database up to date. This |
| 82 | +includes applying upgrades across multiple intermediate versions if needed. You do not need to apply each intermediate |
| 83 | +upgrade manually. |
| 84 | + |
| 85 | +The upgrade process updates the default `citydb` schema, all additional data schemas added by the user, and the `citydb_pkg` |
| 86 | +schema, which contains the predefined database functions and procedures. |
| 87 | + |
| 88 | +During the upgrade process, carefully monitor the log messages printed to the console. Look out for any errors or |
| 89 | +warnings, and take appropriate action if any issues are reported. A successful upgrade will conclude with a |
| 90 | +confirmation message similar to: |
| 91 | + |
| 92 | +```bash |
| 93 | +3DCityDB instance successfully upgraded. |
| 94 | +``` |
| 95 | + |
| 96 | +!!! tip |
| 97 | + After completing the upgrade, it is highly recommended to run a `VACUUM` on the affected database tables to ensure optimal |
| 98 | + performance. |
0 commit comments