Scripts

Dump data

The dump_data.sh script can be used to export data from all components (klantinteracties, contactgegevens) to an SQL file or multiple CSV files.

This script is not intended for data migration to another Open Klant instance.

By default, the complete schema and data are generated in two SQL files. This can be adjusted using the flags --data-only, --schema-only & --combined, which generate a single file. By default, the data dump contains all klantinteractie & contactgegevens data.

To export only specific data, the desired component names can be specified:

/dump_data.sh klantinteracties

Note

To export a Postgres 17 database, the postgres-client-17 package is required.

Adding the “–csv” flag exports all tables in the supplied components to CSV files. These files are temporarily placed in “csv_dumps” and combined into a TAR file.

Environment variabelen

  • DB_HOST = db

  • DB_PORT = 5432

  • DB_USER = openklant

  • DB_NAME = openklant

  • DB_PASSWORD = ‘’

  • DUMP_FILE = dump_$(date +’%Y-%m-%d_%H-%M-%S’).sql

  • TAR_FILE (“dump_$(date +’%Y-%m-%d_%H-%M-%S’).tar”)

DB_HOST=localhost DB_NAME=openklant ./bin/dump_data.sh