metafresh logo and link to homepage

Get your local DB up and running

Option one:
Import the dump into your local PostgreSQL instalation


Import the initial dump from command line

To get the database dump into your local database via command line, do as follows, as user postgres:

createuser --login --createdb --no-createrole --no-superuser --encrypted --replication --inherit --pwprompt metasfresh

For convenience and since this is just your local development DB, you might want to also specify --superuser

createdb metasfresh -O metasfresh
pg_restore -Fc -j 2 -d metasfresh metasfresh_latest.pgdump

Note that metasfresh contains more than 1000 tables. Importing the dump might take a while.

…or import the initial dump using pgAdmin

To get the database dump into your local database via pgAdmin, do as follows:


For development purposes, you can create the role with the role privileges LOGIN, SUPERUSER, INHERIT, CREATEDB and NOCREATEROLE


Make sure that the new database is owned by the metasfresh role.

Option two:
Run the DB in docker

If you have a docker host running locally, you can pull and run the latest metasfresh database in it.

To obtain a docker host, you can for example use our vagrant file.

See to get started.

In order to run the PostgreSQL server inside your local virtual machine and access it, you can edit the vagrant file and add a “forwarded port mapping”. To do this, find the respective section in the vagrant file and add something like "forwarded_port", id: "metasfresh-db", guest: 5432 , host: 5432 , host_ip: ""

Once your started your local virtual machine this way and sshed into it, you can run

sudo docker run -p 5432:5432 -t metasfresh/metasfresh-db

To get our latest metasfresh-db and start it up.

Update the database from the master branch

This section describes how to update your local (developer) DB with the latest migration scripts that were just build from the master branch

You can get those migration script by downloading them as a tar.gz file from this URL

Note: under linux, you might want to run

wget --trust-server-names ""

That tar.gz contains

What you still need to provide is the following:


The values written here in this documentation are the defaults which the tool assumes if the respective value is missing.

By default, the tool will assume the settings file to be ~/ (i.e. usually /home/metasfresh/ If you need to specify a different settings file, please run -h and check out the help message (-d and -s options).

Note: it might generally be a good idea to first run -h and take a look at the help message.

When the tool runs, it scans a directory for SQL files and applies those files that were not yet recorded in the AD_MigrationScript table of the metasfresh database.

Prepare the DB to contribute SQL migration scripts

When you want to contribute SQL migration scripts, you need to obtain an account on our central ID server Then, with those credentials, you can update your developer database as follows

UPDATE AD_SysConfig SET Value='metas' WHERE AD_SysConfig_ID=50005;  --"PROJECT_ID_PROJECT"
UPDATE AD_SysConfig SET Value='<your-login>' WHERE AD_SysConfig_ID=50006;  --"PROJECT_ID_USER"
UPDATE AD_SysConfig SET Value='<your-password>' WHERE AD_SysConfig_ID=50007; --"PROJECT_ID_PASSWORD"
UPDATE AD_SysConfig SET Value='' WHERE AD_SysConfig_ID=50004; --"PROJECT_ID_WEBSITE"
UPDATE AD_SysConfig SET Value='' WHERE AD_SysConfig_ID=50008; --"PROJECT_ID_COMMENTS"

Then, when you insertfor example a new record into AD_Column, the system will obtain a unique AD_Column_ID from to make sure that the ID does not collide with another ID from another local DB.

Further reading and doing:

Zur Quelldatei auf