Skip to content

Commit 548ba38

Browse files
committed
added chapter on upgrading a 3DCityDB
1 parent 98dda5b commit 548ba38

File tree

4 files changed

+107
-1
lines changed

4 files changed

+107
-1
lines changed

docs/3dcitydb/.pages

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ nav:
99
- Codelist module: codelist-module.md
1010
- db-scripts.md
1111
- db-functions.md
12+
- db-upgrade.md
13+
- docker.md
1214
- ...

docs/3dcitydb/db-scripts.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ The following table provides an overview of the available shell scripts and thei
3636
| `revoke-access` | Revokes read-only or read-write access to a 3DCityDB instance, which has been granted with `grant-access` |
3737
| `create-changelog` | Create the changelog extension for a 3DCityDB instance |
3838
| `drop-changelog` | Remove the changelog extension from a 3DCityDB instance |
39+
| `upgrade-db` | Upgrade an existing 3DCityDB instance to a newer minor or patch version |
3940

4041
The scripts are intended to run in an interactive shell session, prompting the user for necessary information to perform
4142
their tasks. The `connection-details` script serves a special purpose, as it defines the connection details for your

docs/3dcitydb/db-upgrade.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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.

docs/first-steps/setup.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,4 +218,9 @@ ALTER DATABASE new_citydb_v5 SET search_path TO citydb, citydb_pkg, public;
218218

219219
!!! info
220220
If your 3DCityDB template contains more schemas, ensure to add them all to the `search_path`.
221-
Note that the search path will be updated upon the next login, not within the same session.
221+
Note that the search path will be updated upon the next login, not within the same session.
222+
223+
## Upgrading a 3DCityDB `v5` to the latest release
224+
225+
If you already have a 3DCityDB `v5` installed and running, and want to update it to the latest release instead of
226+
setting up a new instance, please follow this [guide](../3dcitydb/db-upgrade.md).

0 commit comments

Comments
 (0)