Skip to content

Commit

Permalink
database-schema-upgrade: added ON_ERROR_STOP to psql examples
Browse files Browse the repository at this point in the history
Also added warning about clients like pgAdmin.
  • Loading branch information
virgo47 committed Mar 30, 2022
1 parent 61f3f49 commit c1adb5c
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions docs/upgrade/database-schema-upgrade.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -86,24 +86,35 @@ The scripts do not contain any version number and are safe to run repeatedly - o
To upgrade the main repository run this command:
[source,bash]
----
psql -h localhost -U midpoint -W -d midpoint -f postgres-new-upgrade.sql
psql -v ON_ERROR_STOP=1 -h localhost -U midpoint -W -d midpoint -f postgres-new-upgrade.sql
----

To upgrade the audit database (here on the same server, but different database) run:
[source,bash]
----
psql -h localhost -U midaudit -W -d midaudit -f postgres-new-upgrade-audit.sql
psql -v ON_ERROR_STOP=1 -h localhost -U midaudit -W -d midaudit -f postgres-new-upgrade-audit.sql
----

To upgrade database containing both, use multiple `-f` options:
[source,bash]
----
psql -h localhost -U midaudit -W -d midaudit -f postgres-new-upgrade.sql -f postgres-new-upgrade-audit.sql
psql -v ON_ERROR_STOP=1 -h localhost -U midaudit -W -d midaudit \
-f postgres-new-upgrade.sql -f postgres-new-upgrade-audit.sql
----

The scripts store their internal version information in the `m_global_metadata` table.
Please, do not modify this table manually.

[IMPORTANT]
====
You can use other client than `psql`, but the client must send the commands to the server separately.
E.g. IDEA Ultimate Edition or DataGrip from JetBrains work fine.
Some clients, notably https://www.pgadmin.org/[pgAdmin], send the whole content in a single request.
Please, do not use them to run upgrade scripts!
====


== Upgrading Generic Repository

This section describes how to upgrade the xref:/midpoint/reference/repository/generic/[Generic repository].
Expand Down

0 comments on commit c1adb5c

Please sign in to comment.