IriusRisk comes with embedded automatic migration set for all supported databases. This is the recommended workflow, but in case you prefer executing all the database queries by yourself you can do so following the instructions explained in this article.
Disable automatic migrations
First of all, you need to prevent the default behavior of running the migration automatically. This can be controlled by passing the java property "-Dliquibase.enabled=false" to the JVM.
If you are using an application server like Tomcat, you can pass these properties using environment variables.
For example, if you are using a docker-compose in your IriusRisk installation with PostreSQL database, your tomcat8 section should look similar to this:
Note: If you already have a CATALINA_OPTS variable, you can append to it other properties like this:
- CATALINA_OPTS=-Dliquibase.enabled=false -Dkey1=value1 -Dkey2=value2 -Dkey3=value3
Manually apply the migrations
Ones assured that the migrations are disabled and before running the IriusRisk application you need to set your database to the desired state by applying all the necessary SQL queries. You can find all these sequential SQL files depending on the versions you want to upgrade on this link.
The migration files are organized by their corresponding IriusRisk versions. You always need to start by applying first the 2.0.0 migration. After that you should apply all the other existing increments of the database up to your IriusRisk version.
Taking as example a PostgreSQL database and IriusRisk 2.0.0 new installation, you'll need to:
- Download the iriusrisk-migration-2.0.0.sql file and copy it to your database instance.
- Connect to the databse server instance and create a user and database for IriusRisk as explained in Installation manual.
create user iriusprod with createdb password 'alongandcomplexpassword2523';
create database iriusprod with owner = iriusprod;
- Load the SQL file into your database:
psql -U admin iriusprod < iriusrisk-migration-2.0.0.sql
- Since our IriusRisk version is 2.0.0 we don't need to load any other SQL migrations file.
In this point of time we should already have the application configured and all the necessary migrations applied. This is the time to run IriusRisk and check the logs.
Following our example of docker-compose environment, the commands would be:
docker-compose up -d
docker logs -f iriusrisk-tomcat8