Merge pull request #991 from Icinga/doc-04-postgresql-user-schema-upgrade

docs: PostgreSQL User for Schema Upgrades
This commit is contained in:
Alvar 2025-07-03 15:58:53 +00:00 committed by GitHub
commit 6b4ba62a90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -25,6 +25,27 @@ schema versions in their order, starting with the earliest release.
The following commands would apply a sample version 1.2.3 schema upgrade to the `icingadb` database as the `icingadb`
user. Please modify them for your setup and the schema upgrade you want to apply.
!!! important
For PostgreSQL, the schema upgrade must be applied by the `icingadb` PostgreSQL user, since this user owns the
current tables and would own any new table created by the schema upgrade.
If you are unsure whether your PostgreSQL user is named `icingadb`, as stated in the installation section,
you can list the _Owner_ for each table in the `icingadb` database via `\d` in `psql`.
```
$ psql -U postgres icingadb -c '\d'
List of relations
Schema | Name | Type | Owner
--------+-------------------------------+----------+----------
public | acknowledgement_history | table | icingadb
public | action_url | table | icingadb
public | checkcommand | table | icingadb
[ . . . ]
```
This shortened output shows that `icingadb` is the _Owner_ and needs to be set as `-U icingadb` in the following
upgrade command.
* MySQL/MariaDB:
```
mysql -u icingadb -p icingadb < /usr/share/icingadb/schema/mysql/upgrades/1.2.3.sql