Skip to content
Snippets Groups Projects
Commit 4c5accb5 authored by Benjamin Bertrand's avatar Benjamin Bertrand
Browse files

Add documentation about database versioning

parent 77c7ceba
No related branches found
No related tags found
No related merge requests found
......@@ -162,6 +162,31 @@ has the proper access (based on the network)::
if not current_user.has_access_to_network(interface.network):
abort(403)
Database versioning
-------------------
SQLAlchemy-Continuum_ is used to track changes and keep an history.
To enable versioning on a models, the ``__versioned__`` attribute shall be added to the model class.
The following classes are versioned:
- :class:`~app.models.Item`
- :class:`~app.models.Host`
- :class:`~app.models.AnsibleGroup`
The *History* on the view host or view group page displays the list of changes performed.
As there is a relationship between Host and AnsibleGroup, it can lead to unexpected behavior.
1. Edit a group to add a host -> new host added to the group history
2. Edit another host to add it to that group -> new group added to the host history
At this point the group page will show 2 hosts but only one was added in the history.
If the group is edited, to add a variable, the recorded change will display all current hosts in the history.
This is correct as those hosts were present when the group was edited.
But the information showing the hosts were added previously is missing.
This is a limitation of the current implementation.
.. _Flask: https://flask.palletsprojects.com
.. _The Flask Mega-Tutorial: https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world
......@@ -171,3 +196,4 @@ has the proper access (based on the network)::
.. _Elasticsearch: https://www.elastic.co/elasticsearch/
.. _RQ: https://python-rq.org
.. _alembic: https://alembic.sqlalchemy.org
.. _SQLAlchemy-Continuum: https://sqlalchemy-continuum.readthedocs.io/en/latest/
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment