Skip to main content

CLI Database Exporter Importer

About

The Origen Cms Console provides command-line tools for exporting (backing up) and importing (restoring) your Origen Cms database. It's important to note that the console does not back up your filesystem, which should be handled separately.

Requirements

To utilize these commands, you must have secure shell access (SSH) to your host, where the PHP Command Line Interface (CLI) is installed. It is recommended that you have a basic understanding of using shell commands.

Instructions

  1. Log into your host and navigate to the root folder of your site. It is advisable to use the Origen 'tmp' folder, which provides read/write permissions.

  2. List all available commands of the Origen Console:

php cli/origen.php list
  1. Export the database to a specific folder:
php cli/origen.php database:export --folder <folder_path>
  1. Import the database from a specific folder:
php cli/origen.php database:import --folder <folder_path>

You also have the following options:

  • Export the database as a .zip file:
php cli/origen.php database:export --zip
  • Export a specific table:
php cli/origen.php database:export --table <table_name>
  • Export a specific table as a .zip file:
php cli/origen.php database:export --table <table_name> --zip
  • Import a specific table:
php cli/origen.php database:import --table <table_name>
  • If you need help with the commands:
php cli/origen.php database:export --help
php cli/origen.php database:import --help

Back up and restore

To create a full backup of your site, including folders, files, and the database, you can execute the following commands:

  1. Archive your Origen root directory:
tar --exclude='./tmp/origen_bak.*' -zcvf tmp/origen_bak.tgz . > tmp/origen_bak.log
  1. Export the entire Origen database:
php cli/origen.php database:export --all --folder tmp/db_bak

To restore the backup, execute the following commands:

  1. Import the entire Origen database:
php cli/origen.php database:import --all --folder tmp/db_bak
  1. Extract the archive:
tar --recursive-unlink -xvf tmp/origen_bak.tgz .