SmartERP Documentation An Ashewa Technology Solutions Platform

Backup and restore

Take a database backup before every install or update, and how to roll back.

Installing the modules adds tables and columns and is not cleanly undoable. Back up first, every time.

Back up#

pg_dump -Fc -f ~/before.dump <your_db>

-Fc writes PostgreSQL's compressed custom format, which pg_restore reads. If PostgreSQL is on another host, set PGHOST, PGPORT and PGUSER first.

The Route B installer takes this dump for you, to your home directory, and stops if the dump does not write. It prints the exact rollback command.

Odoo also keeps file attachments outside the database, in its data_dir (/var/lib/odoo in the Docker setup). Back that up too if you use attachments.

Restore#

Caution

This replaces the database. Stop Odoo first.

dropdb <your_db> && createdb <your_db>
pg_restore -d <your_db> ~/before.dump

Docker demo#

CommandEffect
./stop.shStops the stack. Keeps the data.
./stop.sh --wipeStops it and deletes the database volumes. The next ./start.sh starts clean.

To keep a demo's exact records, timestamps and audit trail, save a dump as deploy/demo.dump (it is git-ignored, since it holds real schema and records). The next first-run restores from it instead of seeding.

Test a restore#

A backup you have never restored is a hope, not a backup. Restore into a scratch database now and then and open it.

Last updated: 2026-10-16