From 11768581cbe71a1eaf197204b6362d07da4d6c49 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Mon, 19 Dec 2022 21:36:05 +0100 Subject: use fietsupdate in documentation about backups This should be preferred over dealing with raw alembic now. --- doc/administration/backup.rst | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) (limited to 'doc/administration') diff --git a/doc/administration/backup.rst b/doc/administration/backup.rst index 3973298..fb379bc 100644 --- a/doc/administration/backup.rst +++ b/doc/administration/backup.rst @@ -34,20 +34,36 @@ In addition to the actual data, you should also note down the Fietsboek version and the database schema version, as backups can only be restored to the same version! -To view the fietsboek version in case you are using ``git``, you can use the +To view the Fietsboek version in case you are using ``git``, you can use the following command: .. code:: bash git rev-parse HEAD +If you installed Fietsboek via ``pip`` or other means, you can use one of the +following to see the version: + +.. code:: bash + + .venv/bin/pip show fietsboek + .venv/bin/fietsctl version + +To view the data version, use ``fietsupdate``: + +.. code:: bash + + .venv/bin/fietsupdate status -c development.ini + To view the database schema version, use ``alembic``: .. code:: bash .venv/bin/alembic -c development.ini current -Note those value in addition to your backup. +Note those values (Fietsboek version, data version, database schema version) in +addition to your backup, as you will need them when restoring data later or +when troubleshooting the restoration process. Restore ------- @@ -55,17 +71,31 @@ Restore The restoration process works in four steps: First, we ensure that we are on the correct Fietsboek version. If you are using -``git``, this can be done with ``git checkout``: +``git``, this can be done with ``git checkout`` before installing it: .. code:: bash git checkout NOTED_GIT_VERSION_HERE -Then, we get the database schema to the right version: +If you have installed Fietsboek via ``pip``, you can use it to request a +specific version: .. code:: bash - .venv/bin/alembic -c production.ini upgrade NOTED_ALEMBIC_VERSION_HERE + .venv/bin/pip install "fietsboek==vX.Y.Z" + +Next, we run the data migrations: + +.. code:: bash + + .venv/bin/fietsupdate update -c development.ini VERSION_FROM_EARLIER + +We can verify that the database has the correct schema version by using the +same command from earlier and comparing its output to the noted value: + +.. code:: bash + + .venv/bin/alembic -c development.ini current Now, we can restore the data in the database. This step is dependent on the DBMS that you, therefore you should consult its documentation. -- cgit v1.2.3