psql -h localhost -U midpoint -W -d midpoint < postgresql-upgrade-3.9-4.0.sql
Database Schema Upgrade
New midPoint releases usually bring new features. New features usually require the extension of midPoint data model to use them. The changes of data model usually require extension of the schema of the database that stores midPoint objects. This is the usual routine for most midPoint upgrades.
MidPoint distributions come with the database upgrade scripts.
These scripts contain a set of SQL commands (usually
ALTER TABLE commands) that extend the schema of existing database.
The scripts are designed to be non-desctructive, therefore they can safely be executed over a database that is populated with data.
(Of course, the usual backup routine is strongly recommended.)
Upgrade Script Location
<source code root>/config/sql/
The script file name is constructed in a form:
<database>-upgrade-<from version>-<to version>.sql
postgresql-upgrade-3.9-4.0.sql is an upgrade script for PostgreSQL database that upgrades midPoint 3.9 to midPoint 4.0.
Executing the script
The scripts should be executed by the usual way the SQL script is executed for any particular database. Perhaps the best way is to use command-line tools. Please refer to the documentation of your database system for the details. E.g. the upgrade script for PostgreSQL database is usually executed like this:
Strictly speaking, the version term above refers to the database schema version, not the midPoint version.
These are the same for the majority of cases.
A notable exception is midPoint 4.1 that uses database schema version 4.0. So, in that particular case, upgrade scripts are named like