Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
csentry
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ICS Control System Infrastructure
csentry
Commits
4c5accb5
Commit
4c5accb5
authored
4 years ago
by
Benjamin Bertrand
Browse files
Options
Downloads
Patches
Plain Diff
Add documentation about database versioning
parent
77c7ceba
No related branches found
No related tags found
No related merge requests found
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/development/design.rst
+26
-0
26 additions, 0 deletions
docs/development/design.rst
with
26 additions
and
0 deletions
docs/development/design.rst
+
26
−
0
View file @
4c5accb5
...
...
@@ -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/
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment