⟵ hearthere ⟶
  • Quick start
  • Install MIT
  • Install PRO
  • Updating
  • Optimization
  • Update v4-v5
  • Backups
  • Database Backup
  • Using the bin/totum Console Utility
  • You can skip transferring logs and automatically compress to gz:
  • You can skip transferring certain tables:
  • Manually via pg_dump
  • Scheduled Backup
  • File Backup
  • Database Backup Restoration
  • Restoration via the bin/totum Console Utility
  • If replacing the existing one
  • If creating a new one
  • Manual Restoration via PSQL
  • Console utility bin/totum
  • Basics for users
  • Interface and Layout
  • Tables and their parameters
  • Prefilter
  • Fields and their parameters
  • Syntax
  • Code, actions, formatting
  • Relational relationships
  • Calculation order and calculation units
  • Auto-complete calculations and timing
  • Duplicate rows and cycles
  • Comparisons
  • Functions
  • Debugging
  • Print and CSV
  • API
  • Roles and users
  • Notifications
  • Scheduled Actions
  • System tables
  • Trees
  • Anonymous tables
  • External Forms
  • Exporting and importing tables
  • [PRO] MeiliSearch
  • [PRO] Databases
  • [PRO] Custom CSS
  • [PRO] Custom docs
  • [PRO] LDAP AD
  • [PRO] File versions
  • [PRO] List-unsubscribe
  • [PRO] Dynamic fields
  • [PRO] Only Office
  • [PRO] Auth Tokens
  • [PRO] 2FA
  • [PRO] Superlang
  • [PRO] Daemons
  • [PRO] Profiler
  • Connecting functions
  • [SRV] Installation and Connection
  • [SRV] Export, PDF, Upload, and Preview
  • [SRV] XLSX/DOCX Generators
  • Backups

    Database Backup

    The final executors of all operations are pg_dump and psql. If you created a backup on one server and are restoring it on another, make sure you are upgrading the PostgreSQL version with the command psql -V. Downgrading the version will likely result in the backup not being deployed.

    Using the bin/totum Console Utility

    Navigate to the totum folder:

    cd /home/totum/totum-mit
    

    Execute:

    bin/totum schema-backup --schema="SCHEMA_NAME" prod_dump.sql
    

    SCHEMA_NAME = default is totum

    You can skip transferring logs and automatically compress to gz:

    bin/totum schema-backup --schema="SCHEMA_NAME" --no-logs --gz file_dump.sql
    

    You can skip transferring certain tables:

    bin/totum schema-backup --schema="SCHEMA_NAME" --no-content="table_name_1,table_name_2" file_dump.sql
    

    Schema Name

    Manually via pg_dump

    Create a dump. Execute from the root folder of Totum. Replace USER and PASSWORD with those corresponding to your database.

    SCHEMA_NAME — the name of the schema. You can view it in any table in Totum in the upper right corner.

    pg_dump -O -x --dbname=postgresql://USER:PASSWORD@LOCALHOST:5432/DB_NAME --schema="SCHEMA_NAME" > db_backup_name.sql
    
    • -O — means without owner, so this dump can be restored on another host.

    • -x — without privileges.

    • db_backup_name.sql — you can create a backups folder in the root folder of Totum and specify the full or relative path to it along with the name of the backup file.

    bin/totum schema-backup executes the pg_dump command excluding external synchronization logs and temporary tables!

    If you need to export without logs:

    pg_dump -O -x --dbname=postgresql://USER:PASSWORD@LOCALHOST:5432/DB_NAME --schema="SCHEMA_NAME" --no-tablespaces --exclude-table-data='_tmp_tables' --exclude-table-data='_bfl' | grep -v '^--' > db_backup_name.sql
    

    Scheduled Backup

    You can schedule the creation of a dump in cron within Totum using the execSSH function.

    Example of Totum code creating copies in the root folder of Totum:

    PATH_TO_TOTUM_FOLDER — replace with the path to the Totum folder. You can view it by executing pwd in the server console.

    The second action deletes a 7-day-old file. Schedule it in cron to execute once a day.

    Replace SCHEMA_NAME with the schema name (default is totum):

    = : while(action: $a1; action: $a2)
    
    a1: execSSH(ssh: "cd ~/totum-mit && bin/totum schema-backup --schema='SCHEMA_NAME' --gz '%schema%-%Y%-%m%-%d%.sql'")
    
    a2: execSSH(ssh: str`"cd ~/totum-mit && rm SCHEMA_NAME-" + $dm + ".sql.gz"`)
    
            dm: dateAdd(date: $#nd; days: -7; format: "Y-m-d")
    

    If Totum issues a warning about blocking execSSH during execution — remove the comment from the line /* protected $execSSHOn = true;*/ in Conf.php in the root installation folder, it should be -> protected $execSSHOn = true;

    execSSH is available only in the PRO version

    File Backup

    Replace HOST with your Host:

    Files are located at /home/totum/totum-mit/http/fls/HOST and /home/totum/totum-mit/totumTmpfiles/HOST.

    For protected files, /home/totum/totum-mit/secureFiles/HOST.

    You need to back up these folders by any means.

    Database Backup Restoration

    Restoration via the bin/totum Console Utility

    When performing this operation from the root folder of Totum, the database schema is completely replaced with the schema from prod_dump.sql (replace schema_name with your schema):

    If replacing the existing one

    bin/totum schema-replace --with-active-crons file_dump.sql schema_name
    

    If creating a new one

    bin/totum schema-replace --with-active-crons file_dump.sql schema_name host.zone
    

    By default, crons are disabled during loading — --with-active-crons disables this rule

    Manual Restoration via PSQL

    To restore, enter psql and the folder where the backup file is located. Replace USER and PASSWORD with those corresponding to your database.

    psql --dbname=postgresql://user:password@localhost:5432/db_name
    

    Rename the current schema to reserve:

    ALTER SCHEMA schema_name RENAME TO reserve_name;
    
    # enter, semicolon at the end of the line is mandatory
    

    Load the restoration:

    \i backup_file_name
    
    # enter without a semicolon
    

    Check the restoration, and if okay, delete the renamed old schema

    DROP SCHEMA reserve_name CASCADE;
    
    # enter, semicolon at the end of the line is mandatory
    

    How to view the list of all schemas in the database:

    select schema_name from information_schema.schemata;
    
    # enter, semicolon at the end of the line is mandatory
    

    Exit

    \q
    
    # enter