Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions docs/dev/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,43 @@ save some work while typing docker compose commands. This section explains these
``inv docker.manage {command}``
Executes a Django management command in a container.

* ``--backupdb`` creates a database backup before running the command.
The backup is saved to the current directory with a timestamped filename:
``dump_<DD-MM-YYYY>_<HH_MM_SS>__<git-hash>.sql``

.. tip::

Useful when modifying models to run ``makemigrations``.

.. tip::

Use ``--backupdb`` when running ``migrate`` to create a backup before applying migrations:

.. code-block:: bash

inv docker.manage --backupdb migrate

To restore from this backup, follow these steps:

.. code-block:: bash

# Start only the database container
inv docker.compose 'start database'

# Copy the backup file into the container (replace with your actual filename)
docker cp dump_24-11-2025_10_30_00__abc1234.sql community_database_1:/tmp/dump.sql

# Open a shell in the database container
inv docker.shell --container database

Then inside the database container:

.. code-block:: bash

dropdb -U docs_user docs_db
createdb -U docs_user docs_db
psql -U docs_user docs_db < /tmp/dump.sql

``inv docker.down``
Stops and removes all containers running.

Expand Down