Adds automatic ERD generation for the Octavia DB
This patch adds automatic Entity Relationship Diagraming (ERD) for the Octavia database schema. The ERD will be available as part of the Octavia developer reference documentation. Story: 1558379 Task: 5271 Change-Id: I282b4128fcc72babd1a128d95ec0b3342802c2d4
This commit is contained in:
parent
c1a3c630af
commit
8608a59e2e
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,6 +8,7 @@ covhtml/
|
||||
dist/
|
||||
doc/build
|
||||
doc/source/configuration/_static/octavia.policy.yaml.sample
|
||||
doc/source/contributor/devref/erd.svg
|
||||
doc/source/contributor/devref/flow_diagrams/
|
||||
doc/source/contributor/modules
|
||||
.idea/*
|
||||
|
@ -14,12 +14,27 @@
|
||||
import sys
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
from pydotplus import graphviz
|
||||
import sadisplay
|
||||
|
||||
import octavia.db.models as models
|
||||
from tools import create_flow_docs
|
||||
|
||||
# Generate our flow diagrams
|
||||
create_flow_docs.generate(
|
||||
'tools/flow-list.txt', 'doc/source/contributor/devref/flow_diagrams')
|
||||
|
||||
# Generate entity relationship diagram
|
||||
desc = sadisplay.describe(
|
||||
[getattr(models, attr) for attr in dir(models)],
|
||||
show_methods=True,
|
||||
show_properties=True,
|
||||
show_indexes=True,
|
||||
)
|
||||
graph = graphviz.graph_from_dot_data(sadisplay.dot(desc).encode('utf-8'))
|
||||
graph.write('contributor/devref/erd.svg', format='svg')
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
|
17
doc/source/contributor/devref/erd.rst
Normal file
17
doc/source/contributor/devref/erd.rst
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
===================================
|
||||
Octavia Entity Relationship Diagram
|
||||
===================================
|
||||
|
||||
Below is the current Octavia database data model.
|
||||
|
||||
* Solid stars are primary key columns.
|
||||
* Hollow stars are foreign key columns.
|
||||
* Items labeled as "PROPERTY" are data model relationships and are not
|
||||
present in the database.
|
||||
|
||||
Click to enlarge the diagram.
|
||||
|
||||
.. image:: erd.svg
|
||||
:width: 660px
|
||||
:target: ../../_images/erd.svg
|
@ -27,6 +27,7 @@ docutils>=0.11 # OSI-Approved Open Source, Public Domain
|
||||
sphinx>=1.6.2 # BSD
|
||||
graphviz!=0.5.0,>=0.4 # MIT License
|
||||
openstackdocstheme>=1.17.0 # Apache-2.0
|
||||
sadisplay>=0.4.8 # BSD
|
||||
|
||||
# This needs to be installed after above modules
|
||||
pydotplus>=2.0.2 # MIT License
|
||||
|
Loading…
Reference in New Issue
Block a user